Remote Filtering with ListFilter in ExtJS Grid Column Header

后端 未结 1 1980
清酒与你
清酒与你 2021-02-13 21:27

I am using ListFilter plugin to filter results on a Grid panel. The column definition is.

{
    header: \'Provider\',
    filter: {
        type: \'list\',
               


        
1条回答
  •  你的背包
    2021-02-13 21:36

    I didn't tried this myself but you need to set the ID manually with the idField property [new to ExtJS4.1.3] which is per default set to id. So I guess this will work:

    {
        header: 'Provider',
        filter: {
            type: 'list',
            idField: 'provider_id',
            store: Ext.getStore('MyApp.store.Provider'),
            dataIndex: 'provider_id',
            labelField: 'name'
        }
    }
    

    Update

    OK, I looked at the source and I can now tell you that this is the answer. So will have to either live with your workarround until 4.2 is out or you can apply the following changes to your Ext.ux.grid.menu.ListMenu to make it run:

    add the idField with a default value.

    look within the constructor for this lines

    case 'object': options.push([value.id, value[this.labelField]]); break;
    // some more lines
    fields: ['id', this.labelField],
    

    and replace it with

    case 'object': options.push([value[me.idField], value[me.labelField]]); break;
    // some more lines
    fields: [me.idField, me.labelField],
    

    and within the onLoad function look for

    itemValue = records[i].get('id');
    

    and replace it with

    itemValue = records[i].get(me.idField);
    

    and that pretty much is it.

    0 讨论(0)
提交回复
热议问题