I am using a datasource-based Calendar, and would like to include additional fields (from my datasource) in the EventEditor and EventDialog. Those additional fields would be presented as drop-down lists (from SelectItem), and, since the values in the calendar datasource are simply keys (e.g. “personID”, “activityID”), they would need to be mapped to a more friendly values. Reading the documentation, it would seem like OptionDataSource in the SelectItem would be perfect for that task, but a LinkedHashMap (with setValueMap) could also be used. (I tried both, and neither seemed to work properly.)
I started off by trying to alter the Calendar “Custom Event Editing” showcase sample to use OptionDataSource-bound SelectItems for my custom fields. (See CalendarBug.java below, which uses, for simplicity, a RestDataSource with file activities.xml.) I’ve attached the code that I have so far… I’m using SmartGWT 2.4, GWT 2.3, and Chrome/Firefox/IE8. It doesn’t work, with a couple of oddities:
1) After adding my calendar datasource-bound fields via setEventEditorFields, the “name” property of the Item seems to disappear. The simple workaround for that is to set it again after the setEventEditorFields call. But maybe that workaround implies that I’m missing something.
2) In debug/hosted mode (on Eclipse): The field that I attempted with the LinkedHashMap properly converted the key to the friendly name, but the drop-down list does not display any of the other options.
3) In debug mode (on Eclipse): The field that I attempted with the OptionDataSource (“activityID” in the EventEditor) displayed as a combo-box, but did not convert into the display value. Actually, it did not even request the OptionDataSource at all, based upon looking at the Firebug logs. The Developer Console shows an error:
And then another error when clicking on the dropdown list:
4) However, in release/web mode, the drop-downs do not show up at all, and the Item is simply displayed as a text item. This means that key values are shown, and not translated into friendly names. It is odd that debug mode behavior does not match release mode.
5) On the nightly build (SmartGWT 2.5 2011-06-25), the EventDialog doesn’t even show up, as when I try to open it on an event, I get a large messagebox (see attachment “nightlybuild_eventmessage.txt”). It looks like I can’t have any SelectItem on either of the EventEditor or EventDialog windows. (I’m less concerned about this, of course, as it is a “nightly build” after all.)
So... Am I missing something obvious? (Other than brevity?) Is there a bug somewhere in the Calendar EventDialog / EventEditor functionality? Is there a better way of doing this?
Thank you, in advance.
I started off by trying to alter the Calendar “Custom Event Editing” showcase sample to use OptionDataSource-bound SelectItems for my custom fields. (See CalendarBug.java below, which uses, for simplicity, a RestDataSource with file activities.xml.) I’ve attached the code that I have so far… I’m using SmartGWT 2.4, GWT 2.3, and Chrome/Firefox/IE8. It doesn’t work, with a couple of oddities:
1) After adding my calendar datasource-bound fields via setEventEditorFields, the “name” property of the Item seems to disappear. The simple workaround for that is to set it again after the setEventEditorFields call. But maybe that workaround implies that I’m missing something.
2) In debug/hosted mode (on Eclipse): The field that I attempted with the LinkedHashMap properly converted the key to the friendly name, but the drop-down list does not display any of the other options.
3) In debug mode (on Eclipse): The field that I attempted with the OptionDataSource (“activityID” in the EventEditor) displayed as a combo-box, but did not convert into the display value. Actually, it did not even request the OptionDataSource at all, based upon looking at the Firebug logs. The Developer Console shows an error:
Code:
19:16:09.752:MUP3:WARN:SelectItem:isc_SelectItem_8:fetchData() called for a non-databound pickList. Ignoring
Code:
19:17:18.317:MUP0:WARN:Log:TypeError: Cannot call method 'getID' of null
5) On the nightly build (SmartGWT 2.5 2011-06-25), the EventDialog doesn’t even show up, as when I try to open it on an event, I get a large messagebox (see attachment “nightlybuild_eventmessage.txt”). It looks like I can’t have any SelectItem on either of the EventEditor or EventDialog windows. (I’m less concerned about this, of course, as it is a “nightly build” after all.)
So... Am I missing something obvious? (Other than brevity?) Is there a bug somewhere in the Calendar EventDialog / EventEditor functionality? Is there a better way of doing this?
Thank you, in advance.
Comment