want help
want help

Reputation: 41

Ext.grid.CheckboxSelectionModel checked all rows on load

I want my Ext.grid.CheckboxSelectionModel to be loaded with all checkboxes in the SelectionModel checked.

I write this method:

function SelectAllRows()
{     
    var sModel = reportsGrid.getSelectionModel();
    sModel.selectAll(true);    
}

And try to call it from many places:

var xmlStore = new Ext.data.Store({
    url: "...",
    reader: new Ext.data.XmlReader({
        record: '...',
        totalRecords: "results"
    },
    record
)
});

xmlStore.on('load', CheckResults);
xmlStore.on('load', SelectAllRows);
xmlStore.load();

But only on the first entrance to the page it work well, when I come back from the next page it doesn't work.

It is strange that when I add to the bottom bar a label wich contains the sum of a data of the checked rows, and the label show the sum of all rows! So, the method called well, but the checkboxes don't show as checked.

Have you met this problem?

Upvotes: 0

Views: 2480

Answers (1)

want help
want help

Reputation: 41

I saw it happened because of the render activated twice, Added this value -'deferRowRender: false'- to the Ext.grid.GridPanel properties , make the checkboxes be marked on every entrance/load of th page.

var reportsGrid = new Ext.grid.GridPanel({
    cm: new Ext.grid.ColumnModel([
        sm,
        { id: '...', dataIndex: '...', hidden: true },
        { header: '...', width: 200, sortable: true, dataIndex: '...' }
    ]),  
    sm: sm,                  
    deferRowRender: false
});

Upvotes: 4

Related Questions