Rownumberer确实在我的Ext.grid.ColumnModel行上超过了数字1

时间:2012-05-24 13:49:19

标签: extjs

我无法让rownumberer计算我的行数。我只得到每行的数字1而不是1,2,3等等。我哪里错了?谢谢你的帮助。

        var iLineItemCM = new Ext.grid.ColumnModel([
    new Ext.grid.RowNumberer(),
{
    id:'i_line_item_name',
    header: "Line Item Name",
    dataIndex: 'i_line_item_name',
    width: 280,
    editor: new Ext.form.TextArea({
        allowBlank: false
    })
}
,{
    header: "Amount",
    dataIndex: 'i_line_item_amt',
    width: 80,
    align: 'right',
    renderer: 'usMoney',
    editor: new Ext.form.NumberField({
        allowBlank: false,
        allowNegative: false,
        maxValue: 100000
    })
}
]);

1 个答案:

答案 0 :(得分:0)

在使用网格面板并在运行时一次添加一个记录时,我遇到了类似的问题。行编号从记录索引中获取数字,我不得不手动告诉每个记录它的索引是什么

store.load(function(records, operation, success) {
            if (success) {
                // set the index on the record so that the rows will be numbered correctly.
                // this is a known bug in extjs when adding records dynamically
                records[0].index = me.current_count;
                me.current_count++;
                // There is only 1 compound record returned
                me.getGrid().getStore().add(records[0]);