View Full Version : Value is null for remote filtering when store has an idfield other than 'id'

29 Jan 2013, 9:29 AM
Based on the example cell-editing.js I just defined a store and added a filter to the column "Light".
As long as I keep the 'id' in myStore everything is fine (line marked with xxx).

var myStore = Ext.create("Ext.data.Store", {
fields: [
{name:'type', type:'string'},
{name:'name', type:'string'}
idProperty: 'type', // not working
autoLoad: false,
idField: 'type', // not working
property: 'type', // not working
// data : [{type: '1', name: 'Sunny'},{type: '2', name: 'Rain'}] // not working yyy
data : [{id: '1', name: 'Sunny'},{id: '2', name: 'Rain'}] // working xxx

// create the grid and specify what field you want
// to use for the editor at each header.
var grid = Ext.create('Ext.grid.Panel', {
store: store,
features: [filters],
columns: [{
id: 'common',
header: 'Common Name',
dataIndex: 'common',
filter: {},
flex: 1,
editor: {
allowBlank: false
}, {
header: 'Light',
dataIndex: 'light',
width: 130,
filter: {
type: 'list',
dataIndex: 'light',
labelField : 'name',
//idField: 'type', // not working
//valueField: 'type', // not working
value: 'type', // not working
store: myStore

When selecting "Rain" in the column "Light" I will get a request filled with:
filter [{"type":"list","value":["2"],"field":"light"}]
Everything is fine, but when using the definition with the field 'type' (line marked with yyy) I get
filter [{"type":"list","value":[null],"field":"light"}]

What do I have to tell my filter that he will recognize the field 'type'?
The lines marked with "not working" I have already tried. My Extjs version is 4.1.1