List filter in Extjs Grid - extjs

I'm new to EXTJS and i want to create a static Grid in it. I have read some documents and created the grid and i cannot create filter for this. Here is my code and any help would be appreciated.
Ext.application({
name: 'Sample app',
launch: function() {
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [
{name: 'name', type: 'string'},
{name: 'email', type: 'string'},
{name: 'age', type: 'int'},
{name: 'city', type: 'string'}]
});
var userStore = Ext.create('Ext.data.Store', {
model: 'User',
data: [
{ name: 'User1', email: 'user1#test.com', age: 21, city: 'City1' },
{ name: 'User2', email: 'user2#test.com', age: 28, city: 'City3' },
{ name: 'User3', email: 'user3#test.com', age: 24, city: 'City2' },
{ name: 'User4', email: 'user4#test.com', age: 23, city: 'City1' },
{ name: 'User5', email: 'user5#test.com', age: 24, city: 'City3' },
{ name: 'User6', email: 'user6#test.com', age: 26, city: 'City4' }
]
});
var optionsStore = Ext.create('Ext.data.Store', {
fields: ['city'],
proxy: {
type: 'ajax',
url: 'myData',
reader: 'array'
}
});
Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
store: userStore,
width: 400,
height: 200,
title: 'Users',
columns: [
{
text: 'Name',
width: 100,
sortable: true,
dataIndex: 'name',
filter: {type: 'string'}
},
{
text: 'Email Address',
width: 150,
sortable: true,
filterable : true,
dataIndex: 'email',
hidden: false,
filter: {type: 'string'}
},
{
text: 'Age',
width: 150,
sortable: true,
filterable : true,
dataIndex: 'age',
hidden: false,
filter: {type: 'numeric'}
},
{
text: 'City',
flex: 1,
sortable: true,
dataIndex: 'city',
filter: {
type: 'list',
store: optionsStore
}
}
]
});
}
});

Have you tried to have a look to this example

Related

Extjs Grid prevent childtap after childlongpress

https://fiddle.sencha.com/#fiddle/2vt6
On grids a after a childlongpress event a childtap event is also fired.
Is there a simple way to prevent this?
I made workaround for your problem.
I compare the tap point, if the tap is the same as longpress, I reject it.
var userStore = Ext.create('Ext.data.Store', {
data: [{
name: 'Lisa',
email: 'lisa#simpsons.com',
phone: '555-111-1224'
}, {
name: 'Bart',
email: 'bart#simpsons.com',
phone: '555-222-1234'
}, {
name: 'Homer',
email: 'homer#simpsons.com',
phone: '555-222-1244'
}, {
name: 'Marge',
email: 'marge#simpsons.com',
phone: '555-222-1254'
}]
});
var last_point = null;
Ext.create('Ext.grid.Grid', {
renderTo: Ext.getBody(),
store: userStore,
width: 400,
height: 200,
title: 'Application Users',
listeners: {
childtap: function (a, b, c, d) {
if (Ext.encode(b.event.touch.point) != last_point) {
console.log("child tap");
}
last_point = null;
},
childlongpress: function (a, b, c, d) {
last_point = Ext.encode(b.event.touch.point);
console.log("childlongpress Event")
}
},
columns: [{
text: 'Name',
width: 100,
sortable: false,
hideable: false,
dataIndex: 'name'
}, {
text: 'Email Address',
width: 150,
dataIndex: 'email',
hidden: true
}, {
text: 'Phone Number',
flex: 1,
dataIndex: 'phone'
}]
});
Example on fiddle: https://fiddle.sencha.com/#fiddle/3021&view/editor

ComboBox keep visible in Grid editor

I have an editor comboBox in Grid and it only shows when I click row. How to keep it permanent visible in grid? Thanks
How to keep it permanent visible in grid?
If you are using ExtJS version 5.x or higher then you can use widgetcolumn
A widget column is configured with a widget config object which specifies an xtype to indicate which type of Widget or Component belongs in the cells of this column.
I have created an sencha fiddle demo hope this will help you to solve problem or achieve your requirement.
Ext.create('Ext.data.Store', {
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone', {
name: 'checked',
defaultValue: 'AL'
}],
data: [{
name: 'Lisa',
email: 'lisa#simpsons.com',
phone: '555-111-1224'
}, {
name: 'Bart',
email: 'bart#simpsons.com',
phone: '555-222-1234'
}, {
name: 'Homer',
email: 'homer#simpsons.com',
phone: '555-222-1244'
}, {
name: 'Marge',
email: 'marge#simpsons.com',
phone: '555-222-1254'
}]
}),
states = Ext.create('Ext.data.Store', {
fields: ['abbr', 'name'],
data: [{
"abbr": "AL",
"name": "Alabama"
}, {
"abbr": "AK",
"name": "Alaska"
}, {
"abbr": "AZ",
"name": "Arizona"
}]
});
Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
store: Ext.data.StoreManager.lookup('simpsonsStore'),
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone'
}, {
text: 'State',
width: 150,
xtype: 'widgetcolumn',
dataIndex: 'checked',
widget: {
xtype: 'combobox',
flex: 1,
emptyText: 'Select State',
queryMode: 'local',
displayField: 'name',
valueField: 'abbr',
store: states,
listeners: {
select: function (combo, record) {
Ext.Msg.alert('Success', 'Good you have selected <b>' + record.get('name') + '</b>')
var grid = combo.up('grid'),
index = grid.getView().indexOf(combo.el.up('table')),
record = grid.getStore().getAt(index);
console.log(record.getData());
}
}
}
}],
height: 200,
width: 400,
renderTo: Ext.getBody()
});

How to add Paging on Grid Extjs

I am using grid to show data which is working perfectly but now i want to add paging on grid. I have attached screenshot of paging which i want to apply as it is.
I am unable to use paging on my Grid. Please help me to fix this issue.
I have attached my full code below
<script type="text/javascript">
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['name', 'email', 'age']
});
Ext.define('UserStore', {
extend: "Ext.data.Store",
model: 'User',
data: [
{ name: 'Test1', email: 'a#simpsons.com', age: 19 },
{ name: 'Test2', email: 'b#simpsons.com', age: 23 },
{ name: 'Test3', email: 'c#simpsons.com', age: 45 },
{ name: 'Test4', email: 'd#simpsons.com', age: 32 },
{ name: 'Test5', email: 'e#gmail.com', age: 22 },
{ name: 'Test6', email: 'f#gmail.com', age: 23 },
{ name: 'Abh', email: 'g#gmail.com', age: 22 },
{ name: 'Test7', email: 'ashu#gmail.com', age: 29 },
{ name: 'Gt', email: 'Gt#gmail.com', age: 24 },
{ name: 'Mg', email: 'Mg#gmail.com', age: 24 },
]
});
var activityStore = Ext.create('UserStore');
activityStore.load()
Ext.onReady(function () {
Ext.create('Ext.Panel', {
renderTo: Ext.getBody(),
margin: 4,
padding: 4,
width: 400,
title: 'Sample',
buttons: [
{
text: 'Grid', handler: function () {
var model = new Ext.Window(
{
width: 600,
autoScroll: true,
modal: false,
minimizable: true,
maximizable: false,
title: 'Students',
listeners: {
"minimize": function (window, opts) {
window.collapse();
window.setWidth(150);
window.alignTo(Ext.getBody(), 'bl-bl')
}
},
tools: [{
type: 'restore',
handler: function (evt, toolEl, owner, tool) {
var window = owner.up('window');
window.setWidth(600);
window.expand('', false);
window.center();
}
}],
items: [{
xtype: "grid",
store: activityStore,
title: 'Application Users',
columns: [
{
text: 'Name',
width: 100,
align: "center",
sortable: false,
hideable: false,
dataIndex: 'name'
},
{
text: 'Email Address',
width: 150,
sortable: false,
align: "center",
hideable: false,
dataIndex: 'email',
},
{
text: 'Age',
flex: 1,
sortable: false,
hideable: false,
align: "center",
dataIndex: 'age'
}
]
}]
})
model.show();
}
},
]
});
});
</script>
My Output is -:
If you want paging in grid , we need to add pagination toolbar in grid by giving bbar property of grid.
bbar: Ext.create('Ext.PagingToolbar', {
store: activityStore,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
inputItemWidth: 35,
})
And we need to make a paging store as here you are using local data.We need to use PagingMemoryproxy.
Ext.define('UserStore', {
extend: "Ext.data.Store",
model: 'User',
pageSize: 5, // records per page
proxy: {
type: 'memory', // paging memory proxy
enablePaging: true,
data: [
{ name: 'Test1', email: 'a#simpsons.com', age: 19 },
{ name: 'Test2', email: 'b#simpsons.com', age: 23 },
{ name: 'Test3', email: 'c#simpsons.com', age: 45 },
{ name: 'Test4', email: 'd#simpsons.com', age: 32 },
{ name: 'Test5', email: 'e#gmail.com', age: 22 },
{ name: 'Test6', email: 'f#gmail.com', age: 23 },
{ name: 'Abh', email: 'g#gmail.com', age: 22 },
{ name: 'Test7', email: 'ashu#gmail.com', age: 29 },
{ name: 'Gt', email: 'Gt#gmail.com', age: 24 },
{ name: 'Mg', email: 'Mg#gmail.com', age: 24 },
],
}
});
var activityStore = Ext.create('UserStore');
activityStore.loadPage(1); // loading first page
Full Code:(Showing 5 records per page)
Ext.define('User', {
extend: 'Ext.data.Model',
fields: ['name', 'email', 'age']
});
Ext.define('UserStore', {
extend: "Ext.data.Store",
model: 'User',
pageSize: 5,
proxy: {
type: 'memory',
enablePaging: true,
data: [
{ name: 'Test1', email: 'a#simpsons.com', age: 19 },
{ name: 'Test2', email: 'b#simpsons.com', age: 23 },
{ name: 'Test3', email: 'c#simpsons.com', age: 45 },
{ name: 'Test4', email: 'd#simpsons.com', age: 32 },
{ name: 'Test5', email: 'e#gmail.com', age: 22 },
{ name: 'Test6', email: 'f#gmail.com', age: 23 },
{ name: 'Abh', email: 'g#gmail.com', age: 22 },
{ name: 'Test7', email: 'ashu#gmail.com', age: 29 },
{ name: 'Gt', email: 'Gt#gmail.com', age: 24 },
{ name: 'Mg', email: 'Mg#gmail.com', age: 24 },
],
}
});
var activityStore = Ext.create('UserStore');
activityStore.loadPage(1);
Ext.onReady(function () {
Ext.create('Ext.Panel', {
renderTo: Ext.getBody(),
margin: 4,
padding: 4,
width: 400,
title: 'Sample',
buttons: [
{
text: 'Grid', handler: function () {
var model = new Ext.Window(
{
width: 600,
autoScroll: true,
modal: false,
minimizable: true,
maximizable: false,
title: 'Students',
listeners: {
"minimize": function (window, opts) {
window.collapse();
window.setWidth(150);
window.alignTo(Ext.getBody(), 'bl-bl')
}
},
tools: [{
type: 'restore',
handler: function (evt, toolEl, owner, tool) {
var window = owner.up('window');
window.setWidth(600);
window.expand('', false);
window.center();
}
}],
items: [{
xtype: "grid",
store: activityStore,
title: 'Application Users',
columns: [
{
text: 'Name',
width: 100,
align: "center",
sortable: false,
hideable: false,
dataIndex: 'name'
},
{
text: 'Email Address',
width: 150,
sortable: false,
align: "center",
hideable: false,
dataIndex: 'email',
},
{
text: 'Age',
flex: 1,
sortable: false,
hideable: false,
align: "center",
dataIndex: 'age'
}
],
bbar: Ext.create('Ext.PagingToolbar', {
store: activityStore,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
inputItemWidth: 35,
}),
}]
})
model.show();
}
},
]
});
});

How to get handle to a cell field in Extjs Grid

The data for the grid looks something like this:
data: [{
field1: abc
field2: [
{value: 0, label: Blue},
{value: 1, label: Green}
]
},
{
field1: def
field2: [
{value: 0, label: Red},
{value: 1, label: Pink}
]
}]
grid component config looks something like:
{
xtype: 'grid',
....
columns: [
{
dataIndex: field1
},
{
dataIndex: field2
editor: {
xtype: combobox,
displayField: label,
valueField: value,
store: new someSampleStore();
}
}
]
}
Now, the grid's column #2 has a combobox.
For Grid's row 0, column 1; combobox dropdown should display these options: Blue, Green
For Grid's row 1, column 1; combobox dropdown should display these options: Red, Pink
Do I need to manually load the data into each combobox (each row) or is there any way I can specify config in column definition so that the combobox picks up data for 'field2' ?
Have a look at the code below. In essence it does what you want but only works after the first click. I'll let you figure that out. ;-)
Demo: https://fiddle.sencha.com/#fiddle/gec
Ext.application({
name: 'Fiddle',
launch: function() {
var comboStore = Ext.create('Ext.data.Store', {
fields: ['value', 'label'],
data: [{
name: '',
value: ''
}],
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
}
}
});
Ext.create('Ext.data.Store', {
storeId: 'employeeStore',
fields: ['firstname', 'lastname', 'seniority', 'dep', 'hired'],
data: [{
firstname: "Michael",
lastname: "Scott",
seniority: 7,
dep: "Management",
hired: "01/10/2004",
comboData: [{
label: 'Test1',
value: 'testval1'
}, {
label: 'Test2',
value: 'testval2'
}, {
label: 'Test3',
value: 'testval3'
}]
}, {
firstname: "Dwight",
lastname: "Schrute",
seniority: 2,
dep: "Sales",
hired: "04/01/2004",
comboData: [{
label: 'Dwight1',
value: 'testval1'
}, {
label: 'Dwight2',
value: 'testval2'
}, {
label: 'Dwight3',
value: 'testval3'
}]
}, {
firstname: "Jim",
lastname: "Halpert",
seniority: 3,
dep: "Sales",
hired: "02/22/2006",
comboData: [{
label: 'Jim1',
value: 'testval1'
}, {
label: 'Jim2',
value: 'testval2'
}, {
label: 'Jim3',
value: 'testval3'
}]
}, {
firstname: "Kevin",
lastname: "Malone",
seniority: 4,
dep: "Accounting",
hired: "06/10/2007",
comboData: [{
label: 'Kevin1',
value: 'testval1'
}, {
label: 'Kevin2',
value: 'testval2'
}, {
label: 'Kevin3',
value: 'testval3'
}]
}]
});
Ext.create('Ext.grid.Panel', {
title: 'Column Demo',
store: Ext.data.StoreManager.lookup('employeeStore'),
columns: [{
text: 'First Name',
dataIndex: 'firstname',
editor: {
xtype: 'combobox',
displayField: 'label',
valueField: 'value',
store: comboStore,
fields: ['value', 'label']
}
}, {
text: 'Last Name',
dataIndex: 'lastname'
}, {
text: 'Hired Month',
dataIndex: 'hired',
xtype: 'datecolumn',
format: 'M'
}, {
text: 'Department (Yrs)',
xtype: 'templatecolumn',
tpl: '{dep} ({seniority})'
}],
selType: 'cellmodel',
plugins: {
ptype: 'cellediting',
clicksToEdit: 1,
listeners: {
beforeedit: function(editor, context, eOpts) {
testData = context.record.data.comboData;
comboStore.setData(testData);
}
}
},
width: 400,
forceFit: true,
renderTo: Ext.getBody()
});
}
});

extjs4.0 Row grid editor multi select combo showing the keys instead of values when non selected

![ I am using extjs 4 . and using RowEditing plug, added multi selection combo box , The combo box is showing the keys instead of the values , But when I select any row it is showing the values , After that when I do some changes to the data in any gievn row, Then the values start showing .
Also I could not see the checkbox when the row is not selected and showing the checkbox when it is selected .
Code
Model is :
Ext.define('Employee', {
extend: 'Ext.data.Model',
idProperty:'employeeId',
fields: [
{name: 'alertType', type: 'string'},
{name: 'statusCode', type: 'bool'},
{name: 'employeeId', type: 'string'},
{name: 'employeeName', type: 'string'},
{name: 'jobCode', type: 'string'},
{name: 'jobTitle', type: 'string'},
{name: 'jobTarget', type: 'string'},
{name: 'vpPlan', type: 'string'},
{name: 'losPlanName', type: 'string', convert:function(v, record){if(typeof v =="string") return v.split(","); else return v; }},
{name: 'losPlanCodes', type: 'float[]', convert:function(v, record){if(typeof v =="string") return v.split(","); else return v; }},
{name: 'losLocation', type: 'string', convert:function(v, record){if(typeof v =="string") return v.split(","); else return v; }},
{name: 'losLocationCodes', type: 'float[]', convert:function(v, record){if(typeof v =="string") return v.split(","); else return v; }},
{name: 'entity', type: 'string'},
{name: 'locationCode', type: 'string'},
{name: 'deptId', type: 'string'},
{name: 'deptName', type: 'string'},
]
});
Grid Store :-
var directReportiesStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
autoLoad:true,
autoSync: true,
allowSingle: true,
storeId: 'directReportiesStore',
model: 'Employee',
sorters: [{
property: 'employeeName',
direction:'ASC'
}],
proxy: {
type: 'ajax',
url: 'getDirectReportiesJson.do?plannerId='+plannerId,
api: {
update: 'getDirectReportiesJson.do?plannerId='+plannerId,
},
reader: {
type: 'json',
successProperty: 'success',
idProperty: 'employeeId',
root: 'data',
messageProperty: 'message'
},
writer: {
type: 'json',
writeAllFields: false
},
listeners: {
exception: function(proxy, response, operation){
Ext.MessageBox.show({
title: 'REMOTE EXCEPTION',
msg: operation.getError(),
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
});
}
}
},
listeners: {
write: function(proxy, operation){
Ext.example.msg(operation.action, operation.resultSet.message);
}
},
listeners: {
load: function(store,records){
for(var rec=0; rec< records.length; rec++){
for(var i=0; i< Ext.getCmp('employeeGrid').columns.length; i++){
if(Ext.getCmp('employeeGrid').columns[i].getId() =='losLocationCodes'){
alert(Ext.getCmp('employeeGrid').columns[i].getId())
Ext.getCmp('employeeGrid').columns[i].getEditor().setValue(records[rec].get('losLocationCodes'))
alert(records[rec].get('losLocationCodes'));
}
}
}
}
}
});
![][1]
Combo Box stores :
// create the Plan Store
var planStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
storeId: 'planStore',
idIndex: 0,
fields: [
{name: 'planId', type: 'float'},
{name: 'planName', type: 'string'},
{name: 'planTypeName', type: 'string'},
]
});
planStore.loadData(plansJson);
// create the Location Store
var locationStore = Ext.create('Ext.data.Store', {
autoDestroy: true,
storeId: 'locationStore',
idIndex: 0,
fields: [
{name: 'locAreaId', type: 'float'},
{name: 'locAreaName', type: 'string'},
{name: 'active', type: 'string'},
{name: 'inclRegAvg', type: 'string'},
]
});
locationStore.loadData(locationJson);
GRID using all three stores ...
var grid = Ext.create('Ext.grid.Panel', {
store: directReportiesStore,
id:'employeeGrid',
title: 'Employee Varieable Pay Mapping',
width: 1100,
height: 400,
frame: true,
columns: [{
id: 'alertType',
header: 'Alert',
width: 30,
dataIndex: 'alertType',
editor: {
disabled: true
}
} , {
id: 'statusCode',
header: 'Reviewed?',
dataIndex: 'statusCode',
width: 40,
editor: {
xtype: 'checkbox',
cls: 'x-grid-checkheader-editor'
}
} , {
id: 'employeeId',
header: 'Employee Id',
dataIndex: 'employeeId',
width: 50,
editor: {
disabled: true
}
} ,{
id: 'employeeName',
header: 'Employee Name',
dataIndex: 'employeeName',
flex: 1,
editor: {
disabled: true
}
} ,{
id: 'jobCode',
header: 'Job Code',
dataIndex: 'jobCode',
width: 40,
editor: {
disabled: true
}
} ,{
id: 'jobTitle',
header: 'Job Title',
dataIndex: 'jobTitle',
flex: 1,
editor: {
disabled: true
}
} ,{
id: 'jobTarget',
header: 'Job Target',
dataIndex: 'jobTarget',
width: 40,
editor: {
disabled: true
}
} , {
id:'vpPlan',
header: 'VP Plan',
dataIndex: 'vpPlan',
width: 70,
editor: {
xtype: 'combobox',
typeAhead: true,
editable: false,
triggerAction: 'all',
selectOnTab: true,
store: [
['SCAL','SCAL'],
['Shared Svc','Shared Svc'],
],
lazyRender: true,
listClass: 'x-combo-list-small'
}
}, {
id:'losPlanCodes',
header: 'LOS Plan Name',
dataIndex: 'losPlanCodes',
width: 250,
editor: {
xtype: 'combobox',
typeAhead: true,
triggerAction: 'all',
tooltip: 'losPlanName',
selectOnTab: true,
store: planStore,
queryMode: 'local',
lazyRender: true,
multiSelect: true,
displayField: 'planName',
valueField:'planId'
}
}, {
id:'losLocationCodes',
header: 'LOS Location',
dataIndex: 'losLocationCodes',
width: 90,
editor: {
xtype: 'combobox',
typeAhead: true,
triggerAction: 'all',
selectOnTab: true,
autoSelect: true,
store: locationStore,
queryMode: 'local',
multiSelect: true,
lazyRender: true,
valueField:'locAreaId',
displayField: 'locAreaName',
listClass: 'x-combo-list-small'
//value: 'losLocationCodes',
//data : 'losLocationCodes',
/*
listeners : {
'beforeselect' : function(combo, record,index){
},
'change': function(combo, newValue, oldValue){
},
'afterrender': function(combo, record1) {
}
}
*/
}
},{
id: 'Entity',
header: 'entity',
dataIndex: 'entity',
width: 30,
editor: {
disabled: true
}
} , {
id: 'locationCode',
header: 'Location Code',
dataIndex: 'locationCode',
width: 50,
editor: {
disabled: true
}
} ,{
id: 'deptId',
header: 'Dept Code',
dataIndex: 'deptId',
width: 50,
editor: {
disabled: true
}
} ,{
id: 'deptName',
header: 'Dept Name',
dataIndex: 'deptName',
flex: 1,
editor: {
disabled: true
}
}],
selModel: {
selType: 'cellmodel'
//selType: 'checkboxmodel'
},
renderTo: 'editor-grid',
tbar: [{
text: 'Select All'
}],
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToMoveEditor: 1,
pluginId: 'employeeEditing',
autoCancel: false,
listeners: {
'beforeedit': function(editor, e, eOpts) {
// alert(editor.rowIdx)
// alert(editor.field)
// alert(editor.value)
if (editor.record.get('entity') == 2 || editor.record.get('entity') == 02){
grid.getPlugin('employeeEditing').editor.form.findField('losPlanCodes').disable();
grid.getPlugin('employeeEditing').editor.form.findField('losLocationCodes').disable();
} else if (editor.record.get('entity') == 8 || editor.record.get('entity') == 08){
grid.getPlugin('employeeEditing').editor.form.findField('losPlanCodes').disable();
}
/*
var me = this;
this.isEditAllowed = false;
this.cancelEdit();
Ext.MessageBox.show({
title: 'Not Allowed to Edit',
msg: 'Not Allowed to Edit this record with entity'+ this.entity,
icon: Ext.MessageBox.INFO,
buttons: Ext.Msg.OK
});
return true;
*/
},
'cancelEdit': function(editor) {
grid.getPlugin('employeeEditing').editor.form.findField('losPlanCodes').enable();
grid.getPlugin('employeeEditing').editor.form.findField('losLocationCodes').enable();
},
'validateedit': function(e) {
},
'edit': function(editor) {
if (editor.record.get('entity') == 2 || editor.record.get('entity') == 02){
grid.getPlugin('employeeEditing').editor.form.findField('losPlanCodes').enable();
grid.getPlugin('employeeEditing').editor.form.findField('losLocationCodes').enable();
}
else if (editor.record.get('entity') == 8 || editor.record.get('entity') == 08){
grid.getPlugin('employeeEditing').editor.form.findField('losPlanCodes').enable();
}
}
}
})
],
listeners: {
'render': function(grid) {
}
}
});
grid.getSelectionModel().on('selectionchange', this.onSelectChange, this);
Please help
][1]
Most likely you are setting the value of the combobox BEFORE its data is loaded. Review the order of the events, try to use a callback for when the store has loaded, and setting its value after that.
You probably figured this out by now, but in case not, you need a custom renderer on the column config to pluck the displayfield out, i.e:
{
id:'losPlanCodes',
header: 'LOS Plan Name',
dataIndex: 'losPlanCodes',
width: 250,
editor: {
xtype: 'combobox',
typeAhead: true,
triggerAction: 'all',
tooltip: 'losPlanName',
selectOnTab: true,
store: planStore,
queryMode: 'local',
lazyRender: true,
multiSelect: true,
displayField: 'planName',
valueField:'planId'
},
renderer: function(value, metaData, record, row, col, store, view) {
return planStore.getById(value).get('planName');
}
},

Resources