OK, this is probably pretty easy, but I can't seem to find out how to do it. When a user is changing a select list item I want to be able to take an action of adding a tab (or if it is already added, just change its title and contents) and set that tab's title to the display text of the select box. Any hints? thanks...
Announcement
Collapse
No announcement yet.
X
-
Pretty straightforward - add a change() handler to the field - e.g:
change() handler docs are here: http://www.smartclient.com/docs/5.5....ormItem.changeCode:isc.DynamicForm.create({ fields: [ {name: "foo", valueMap: { foo: "Bar" } change : function form, item, value, oldValue) { //create your tab here } } ] });
-
pretty straight forward except for getting that new Display value that will become the name of the new tab. I read in the documentation that in the change handler the new value hasn't been set yet, so calling item.getDisplayValue() wouldn't be useful. And indeed it returns 'undefined' when called within the change handler.
I would hate to have to create a whole new service and ajax call to get the string corresponding to the new value especially since the data is already sitting in the datasource and in the valueMap of the select box, I just don't know how to get at it. I figured calling something like item.getValueMap() might work, but no go. Any other options I can look into?
Comment
-
Hi jjohns,
We've added support to getDisplayValue() to allow you to pass in a value instead of relying on the current value of the form. In the meantime, you can use the undocumented formItem.mapValueToDisplay(storedValue) to get the current display value (if there is one and it's been loaded).
Comment
Comment