I'd like to add my own logic for when the user drags a record for reordering. I can't find anything in the documentation - could you please tell me if there is a way to do this?
Announcement
Collapse
No announcement yet.
X
-
The SelectItem "pickList" is a subclass of ListGrid, so yes, you could use pickListProperties to apply canReorderRecords and a recordDrop handler to it.
Be aware that you're moving into slightly uncharted territory (there is some specialized event handling for pickLists which shouldn't impact drag/drop directly but does of course impact things like record click).
If you find you can't get the behavior you're after with these properties, let us know what you're trying to achieve and we may be able point you in the right direction.
Comment
-
Ok. Currently we are using select item to show the valuemap in multiple lines. Problem is in order to do this we had to set "multiple" to true - I can easily ignore the multiple selections but if I drag one record through the select item's body, it automatically selects the records I hover over.
Ultimately, we want to have a control in which the user can specify the sort order of the value map by drag/drop within the same control. We would then save this new sort order in the database for when this valuemap is used elsewhere. This valuemap would never be a big list which is why I am trying to make it work on a select item instead of using a listgrid - our select items are not bound to a datasource whereas our listgrids are, which would cause an extra server call separate from our own data updates.
Code:isc.DynamicForm.create({ width: 500, fields: [{ name: "shipTo", title: "Ship to", type: "select",height: 100,multiple:true,multipleAppearance :"grid", pickListProperties:{canReorderRecords:true,selectionType:"single", recordDrop:function(dropRecords, targetRecord, index, sourceWidget){isc.warn('recorddrop');}}, valueMap: { "US" : "<b>United States</b>", "CH" : "China", "JA" : "<b>Japan</b>", "IN" : "India", "GM" : "Germany", "FR" : "France", "IT" : "Italy", "RS" : "Russia", "BR" : "<b>Brazil</b>", "CA" : "Canada", "MX" : "Mexico", "SP" : "Spain" }, imageURLPrefix:"flags/16/", imageURLSuffix:".png", valueIcons: { "US" : "US", "CH" : "CH", "JA" : "JA", "IN" : "IN", "GM" : "GM", "FR" : "FR", "IT" : "IT", "RS" : "RS", "BR" : "BR", "CA" : "CA", "MX" : "MX", "SP" : "SP" } }] });
Comment
Comment