PDA

View Full Version : Populate dynamically selected items of a item selector



Angelo Santos
7 Aug 2009, 6:33 AM
Hi ,

Im novice user of ExtJs and Im trying to populate dynamically selected items of a item selector from another source (store).
In fact I have a grid, and when a click over a record of this grid, should populate my itemselector with the records already selected for that record, and of course, remove from avaliables items that are correspondent with the records inserted over the selected column.
Have a way to do this?
Im get crazy to figure out how!
I appreciate all your help!

joco23
7 Aug 2009, 10:24 AM
I'm having the same problem. Anyone here who can help?

michaelc
21 Aug 2009, 6:28 PM
it should have an associated store, you can do an add the the store of the record you wish to add and it should then appear in your list

so it this case avaliableApplicationListStore.add(createdRecord); should give me a new row in the item selector


//Store that holds role list data
var avaliableApplicationListStore = new Ext.data.JsonStore({
fields: [{
name: "value",
mapping: 'code'
}, {
name: "text",
mapping: 'name'
}]
});

.......
xtype: "itemselector",
name: "applicationSelector",
fieldLabel: "Applications",
id: id + '-applicationSelector',
minSelections: 1,
multiselects: [{
width: 250,
height: 150,
store: avaliableApplicationListStore,
displayField: 'text',
valueField: 'value'
}, {
width: 250,
height: 150,
store: assignedApplicationListStore,
displayField: 'text',
valueField: 'value',
tbar: [{
text: "clear",
handler: function(){
formPanel.getForm().findField("applicationSelector").reset();
}
}]
}],
imagePath: 'js/extextensions/images/'