如何将复选框列添加到Extjs Grid(how to add checkbox column to Extjs Grid)
我有EXTjs网格。 我想知道如何将复选框添加到Extjs网格列。
在我的数据表中,我将获得“状态”列的值。 它可能是真的/假的。 所以基于它应该显示复选框列选中/未选中。
I have EXTjs grid. I want to know how to add the checkbox to the Extjs grid column.
in my datatable I'll get the value for the column 'Status'. it may br either true/false. so based on that it should show the checkbox column checked / unchecked.
最满意答案
看看这里的示例。 它使用名为CheckBoxColumn的插件(您将必须查看源代码并找到JS文件。
插件文件中的一些示例用法...
var checkColumn = new Ext.grid.CheckColumn({ header: 'Indoor?', dataIndex: 'indoor', id: 'check', width: 55 }); // add the column to the column model var cm = new Ext.grid.ColumnModel([{ header: 'Foo', ... }, checkColumn ]); // create the grid var grid = new Ext.grid.EditorGridPanel({ ... cm: cm, plugins: [checkColumn], // include plugin ... });Have a look at the sample here. It uses a Plugin called CheckBoxColumn (you will have to View Source and find the JS file.
Some example usage from the Plugin's file...
var checkColumn = new Ext.grid.CheckColumn({ header: 'Indoor?', dataIndex: 'indoor', id: 'check', width: 55 }); // add the column to the column model var cm = new Ext.grid.ColumnModel([{ header: 'Foo', ... }, checkColumn ]); // create the grid var grid = new Ext.grid.EditorGridPanel({ ... cm: cm, plugins: [checkColumn], // include plugin ... });更多推荐
发布评论