forum member I am having one problem is displaying the combobox name selected values to my gridpanel column.
I am having the gridPanel with one column containing the resources combobox and the user can select multiple values from the resource.
below is my gridpanel column with the column combobox gridpanel column
{
xtype: 'gridcolumn',
dataIndex: 'resourceid',
text: 'Resource',
field: resourcecombo
},
resourcecombo
var resourcecombo = new Ext.form.ComboBox({
id: 'resourceid',
name: 'resourceid',
emptyText: 'Select resource',
displayField: 'firstname',
store: Ext.create('rms.store.employee'),
valueField: 'id',
multiSelect: true,
queryMode: 'local',
typeAhead: true
});
here I getting the list of resources and I can do multiselect also. Based on this multiselect the id is send to server and with the response I want to set the values to grid column.
but, something wrong is there I am getting the correct response from server, but my gridcolumn displays only one name in this column..
I want to display the name of all the resource selected, separated by comma sign , like rishi,yogi,hiren etc
solution just change the gridcolumn with below code
xtype: 'gridcolumn',
dataIndex: 'resources',
header: 'Resources name',
field: resourcecombo,
renderer: function(resources){
var result = [];
resources = resources || [];
for (var idx = 0, len = resources.length; idx < len; idx++ ){
var value = resources[idx].name;
if(value){
result.push(value);
}
}
return result.join(', ');
}
and change the model with below code
Ext.define('rms.model.taskmainModel', {
extend : 'Ext.data.Model',
fields : [
{ name : 'id', type : 'int' },
{ name : 'taskname', type: 'string'},
**{ name : 'resources', type: 'auto'},**
{ name : 'cmpname', mapping: 'project.company.cmpname'}
]
});
above solution works for me, hope this may help some one.
thanks for your support.