PDA

View Full Version : How to load itemselector



amanind
21 Jul 2010, 2:43 AM
How to load data in itemselector

After ajax i got data in array and called the below function, Now what i have to do to show data in itemselector


loadInvestMultilist: function() {
var investData = arguments[0].reportData;
this.fromStore = new Ext.data.Store({
id: 'fromStore',
data: investData,
reader: new Ext.data.JsonReader(
{
id: 'Id'
},
Ext.data.Record.create([
{ name: 'Id', mapping: 'Id' },
{ name: 'Name', mapping: 'Name' }
])
)
});
this.toStore = new Ext.data.Store({
id: 'toStore',
data: this,
reader: new Ext.data.JsonReader(
{
id: 'Id'
},
Ext.data.Record.create([
{ name: 'Id', mapping: 'Id' },
{ name: 'Name', mapping: 'Name' }
])
)
});
}


here is code for my itemselector

items: {
xtype: 'itemselector',
name: 'investSelector',
id: 'investSelector',
imagePath: "ExtLib/plugins/images/",
imagePath: Module.getEnv('EXTUX_MULTISELECT_PATH')+"images/",
drawUpIcon: false,
drawDownIcon: false,
drawTopIcon: false,
drawBotIcon: false,
width: 400,
height: 180,
multiselects: [{
width: 150,
height: 150,
legend: " ",
draggable:false,
droppable:false,
store:this.fromStore,
displayField: 'Name',
valueField: 'Id'
},{
width: 150,
height: 150,
legend: " ",
draggable:false,
droppable:false,
store: this.toStore,//[["0", "All"]],
displayField: 'Name',
valueField: 'Id'
}]
}

amanind
21 Jul 2010, 4:06 AM
Experts please help me

ext_user1
3 Aug 2010, 11:19 AM
I also tried this example.

The values on the right box are displayed only when the display-field name is 'text'.
If I change the name, even in the same example code (ExtJS example), it doesn't work.

Please advise.

amanind
3 Aug 2010, 11:22 AM
Can you tell me what exactly your requirements is and show me your code

ext_user1
3 Aug 2010, 11:44 AM
ItemSelector at http://www.sencha.com/deploy/dev/examples/multiselect/multiselect-demo.html

I tried with field names other than 'text', 'value', but it doesn't work.

ext_user1
3 Aug 2010, 1:47 PM
You can find the example at examples/ux/ItemSelector.js in the installed extJS.

The problem with 'text', 'value' fields is resolved by having field mappings in the JsonStore.

Another problem still is that the ItemSelector select box doesn't have scrollBar even if more items are there.

Anybody please help.

ext_user1
4 Aug 2010, 7:33 AM
The problem with scrollBar is solved after including MultiSelect.css.

There is another problem now that the values sent to the server are now the displayvalues and not actual values.
But it works correctly when I tried from the example page. when I copied the code and tried, it didn't work.
Not sure what is wrong.

amanind
4 Aug 2010, 10:54 PM
Are you using this property (valueField: 'Id') in your itemselector, pass your actual value to "valueField"