PDA

View Full Version : ItemSeletor



henryivy
24 Feb 2011, 2:05 AM
I have a problem with ItemSeletor.While moving the items between fromStore to ToStore ,some other items are suddenly disappearing in fromStore.I don't know why this is happening.

my code

formItemSelector = new Ext.ux.ItemSelector({
name: 'itemselector',
fieldLabel: 'ItemSelector',
fromStore: storeAllPG,
toStore: storeSectorPGList,

msWidth: 400,
msHeight: 400,
valueField: 'pId',
displayField: 'pName',
width: 900,
allowDup: false,
listeners: {
change: function (sm, row, rec) {
// Clear the assigned peer group sector detail when no peer group selected.
if (sm.toStore.data.items.length == 0) {
listSector.destroy();
ShowPgSector();
}
}
}
});


Is there any property do i need to set for this?

Can anyone please suggest me.

thanks in Advance.

Condor
24 Feb 2011, 2:13 AM
Do the from and to stores have a unique idProperty specified?

What is that change event handler doing? Could it affect the ItemSelector?

henryivy
24 Feb 2011, 2:32 AM
Hi Condor,
thanks for your Reply.

I have a data like Group and SectorOfGroup

the Group is having all data,and SectorGroup is having only specific data.
So,First i am loading Group data into fromStore,and SectorGroup data into toStore.

The Change event handler is used to show the details of the selected 'SectorGroup' item.

Code for Change Eventhandler

function ShowPeerGroupSector() {

var store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: '/PG/GetSectorRelatedGroup/'
})
,
reader: new Ext.data.JsonReader(
{ root: 'Sectors',
id: 'id',
totalRecords: '@total'
},
['Id', 'GroupName'])
});

listSector = new Ext.ux.Multiselect({
name: 'multiselect',
fieldLabel: 'MultiSelect',
store: store,
displayField: 'GroupName',
valueField: 'Id',
width: 400,
height: 100
});
listSector.render(Ext.get('divGroupSector'));
}

Condor
24 Feb 2011, 2:42 AM
Shouldn't that be id:'Id' in the JsonReader config?

henryivy
24 Feb 2011, 7:25 AM
I changed the id to Pid.but still same problem

Condor
24 Feb 2011, 7:27 AM
"Pid"? The 'id' needs to be a property that holds a unique value for each record. Does it?