How to Bind dataIndex to Select All check box

情到浓时终转凉″ 提交于 2019-12-11 11:11:39

问题


I am trying to bind checkbox field to gird with select all options -

 xtype: 'grid',
 store: {
        type: 'webapi',
        api: {
            read: 'api/Report/GetIfo'
        },
        autoLoad: true,
    },
 columns: [    
        { header: 'Name', dataIndex: 'first_name'}
    ], 
    selModel: {
                selType: 'checkboxmodel',    
                //dataIndex:'flag',
                //showHeaderCheckbox: true
            }

I am trying to bind the dataIndex to it so that when grid is loaded, respective checkbox will be selected.

I tried by using

selModel: {
                selType: 'checkboxmodel',    
                //dataIndex:'flag',
                //showHeaderCheckbox: true
            }

But no success. Please suggest me on how to bind the dataIndex here.


回答1:


My suggestion to you is use https://docs.sencha.com/extjs/5.0/5.0.1-apidocs/#!/api/Ext.grid.column.Check

Flag have to true or false if not, you should convert in your model like

{ name: 'flag', type: 'bool',
        convert: function (v) {
            return (v === "True" || v === true) ? true : false;
        }
    }


来源:https://stackoverflow.com/questions/37074408/how-to-bind-dataindex-to-select-all-check-box

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!