PDA

View Full Version : [solved] Itemselector: second multiselect box has empty values



hadi78
15 Dec 2009, 2:46 AM
Hi,

i have a small problem with my itemselector:

the first multiselect box is filled correctly with the store i add to it. But whenever i insert a new item (by doubleclicking or pressing right arrow button) to the second multiselect box it dosen't show up. I just see an empty value inserted to the destination box. When i remove the empty item from the destination then it is showed in the source box correctly again.

Here is my code:



{
xtype: 'itemselector',
name: 'itemselector',
drawUpIcon:false,
drawDownIcon:false,
drawTopIcon:false,
drawBotIcon:false,
id: 'add-case-citizenships-'+tCase.id,
fieldLabel: traffickers_citizenships,
imagePath: '/ext/examples/ux/images/',
multiselects: [{
width: 140,
height: 200,
store: citizenship_store,
droppable: false,
draggable: false,
displayField: 'label',
style: 'background-color: #FFF',
valueField: 'id'
},{
width: 140,
height: 200,
store: new Ext.data.ArrayStore(),
droppable: false,
draggable: false,
style: 'background-color: #FFF',

}]
},

hadi78
15 Dec 2009, 3:16 AM
i found now 1 other thread with the same issue but with no solutions

http://www.extjs.com/forum/showthread.php?t=77181&highlight=itemselector

this is my store:



var countries = new Ext.data.Store({
reader: new Ext.data.JsonReader({
idProperty: 'id',
root: 'countries',
totalProperty: 'results',
fields: [
{ name: 'id', mapping: 'country.id' },
{ name: 'label', mapping: 'country.label' }
]
}),
proxy: new Ext.data.HttpProxy({
url: '/victims/countries',
method: 'GET'
}),
autoLoad: true, // turn on server-side sorting
sortInfo: {field: 'label', direction: 'ASC'}
});

hadi78
15 Dec 2009, 3:49 AM
i fixed the problem. For all who have got the same problem:

just add the valueField and displayField to both multiselects items



{
xtype: 'itemselector',
name: 'itemselector',
drawUpIcon:false,
drawDownIcon:false,
drawTopIcon:false,
drawBotIcon:false,
id: 'add-case-citizenships-'+tCase.id,
fieldLabel: traffickers_citizenships,
imagePath: '/ext/examples/ux/images/',
multiselects: [{
width: 140,
height: 200,
store: citizenship_store,
droppable: false,
draggable: false,
displayField: 'label',
style: 'background-color: #FFF',
valueField: 'id'
},{
width: 140,
height: 200,
store: new Ext.data.ArrayStore(),
displayField: 'label',
valueField: 'id',
droppable: false,
draggable: false,
style: 'background-color: #FFF',

}]
},



My next problem is now on how to set the values after saving them in the database. the setValue() method seems not to work for me yet. i pass the setValue method an array of id's (this works great for the multiselect box but dosen't seem to work for itemselector)

jainanuj82
3 Mar 2011, 1:49 AM
I have similar problem of setting value in itemselector.
setValue() is no function defined.
I am not able to set values in itemselctor after loading from database.
Thanks to help..