PDA

View Full Version : ItemSelector/Multiselects : this.Multiselects is null



marxan
28 Mar 2011, 12:37 AM
Hello,

I try to use the multiselect extension but I get the error message this.multiselects is null.

Here is my code:


Ext.onReady(function() {

var ds = new Ext.data.Store({
totalProperty: 'DATASET',
root: 'ROWS',
url: '../components/JSONPreferences.cfc',
baseParams:
{
method: 'GetReferences',
returnFormat: 'JSON',
}
});

ds.load();


var formItemSelector = new Ext.FormPanel();

var itemSelector = new Ext.ux.ItemSelector({

name : 'itemselector',
fieldLabel : 'ItemSelector',
dataFields : ['Project', 'Reference'],
imagePath: '#Variables.ExtjsPath#examples/ux/images/',
fromStore: ds,
valueField: 'Project',
displayField: 'Reference',
msWidth: 200,
msHeight: 200


});

formItemSelector.add(itemSelector);
formItemSelector.render('form-ct-itemselector');

});

And this is the format of my Json:

{"DATASET":191,"ROWS":[{"Project":221889.0,"Reference":221889.0}]}

If anyone could help. I've already spent a couple of days on that and I still have found what to do to make this thing working.

Thanks in advance.

Marxan

zonathen
27 Aug 2011, 2:03 PM
This was tripping me up too. Looks like most of the examples out there are not for ext 3+, where you need to define the multiselects inside the itemselector like so:


items:[{
xtype: 'itemselector',
name: 'itemselector',
fieldLabel: 'ItemSelector',
imagePath: 'ext-3.0.0/examples/ux/images/',
multiselects: [{
width: 250,
height: 200,
store: ds,
displayField: 'text',
valueField: 'value'
},{
width: 250,
height: 200,
store: [['10','Ten']],
tbar:[{
text: 'clear',
handler:function(){
isForm.getForm().findField('itemselector').reset();
}
}]
}]
}],

At least the itemselector is showing now.

Hope that helps!