为什么此复选框列不在此ExtJS网格中?

时间:2011-01-26 08:08:26

标签: javascript extjs

以下ExtJS网格一直工作,直到我将复选框列放入其中,现在我收到此错误:

Cls error

我基于this code上的复选框列代码。

如何让复选框列工作?

var myData = [
    [4, 'This is a whole bunch of text that is going to be word-wrapped inside this column.', 0.24, true, '2010-11-17 08:31:12'],
    [16, 'Computer2', 0.28, false, '2010-11-14 08:31:12'],
    [5, 'Network1', 0.02, false, '2010-11-12 08:31:12'],
    [1, 'Network2', 0.01, false, '2010-11-11 08:31:12'],
    [12, 'Other', 0.42, false, '2010-11-04 08:31:12']
];

var myReader = new Ext.data.ArrayReader({}, [{
        name: 'id',
        type: 'int'
    }, {
        name: 'object',
        type: 'object'
    }, {
        name: 'status',
        type: 'float'
    }, {
        name: 'rank',
        type: 'boolean'
    }, {
        name: 'lastChange',
        type: 'date',
        dateFormat: 'Y-m-d H:i:s'
    }]);

var grid = new Ext.grid.GridPanel({
    region: 'center',
    style: 'margin: 10px',
    store: new Ext.data.Store({
        data: myData,
        reader: myReader
    }),
    columns: [{
            header: 'ID',
            width: 50,
            sortable: true,
            dataIndex: 'id',
            hidden: false
        },
        {
            header: 'Object',
            width: 120,
            sortable: true,
            dataIndex: 'object',
            renderer: columnWrap

        }, {
            header: 'Status',
            width: 90,
            sortable: true,
            dataIndex: 'status'
        },
        {
            xtype: 'checkcolumn',
            header: 'Test',
            dataIndex: 'rank',
            width: 55
        },
        {
            header: 'Last Updated',
            width: 120,
            sortable: true,
            renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
            dataIndex: 'lastChange'
        }],
    viewConfig: {
        forceFit: true,
        getRowClass: function(record, rowIndex, rp, ds){
            if(rowIndex == 2){
                return 'red-row';
            } else {
                return '';
            }
        }

    },
    title: 'Computer Information',
    width: 500,
    autoHeight: true,
    frame: true,
    listeners: {
        'rowdblclick': function(grid, index, rec){
            var id = grid.getSelectionModel().getSelected().json[0];
            go_to_page('edit_item', 'id=' + id);
        }
    }
});

1 个答案:

答案 0 :(得分:3)

您收到此错误,因为您尚未包含CheckColumn扩展名。您可以从以下网址获取扩展程序:http://dev.sencha.com/deploy/dev/examples/ux/CheckColumn.js ..包含它,您应该可以删除错误..