PDA

View Full Version : Checkbox of CheckboxSelectionModel in Wrong Column!?



anfla
24 Sep 2013, 1:56 AM
Heya, community..!

I'm encountering an unexpected problem. I have a grid with a CheckboxSelectionModel. I have a column with that model, too.. But it doesn't matter in which way I insert that column.. It's always shown as the second one. (After the first non-checkbox-column) But it should be the first one..!

Here is my code:

Definition of ColumnModel:


colModel: new Ext.grid.ColumnModel({
columns: [{
header: _("Name"),
sortable: false,
dataIndex: "name",
id: "name"
},{
header: _("Path"),
width: 450,
sortable: false,
dataIndex: "path",
id: "path"
},{
header: _("Mode"),
sortable: false,
dataIndex: "mode",
id: "mode"
}]
})


The column "Name" is the first one shown in my grid.

Now I'm appending my CheckboxSelectionModel and column a little later:


this.sm = new Ext.grid.CheckboxSelectionModel({
singleSelect: false
});
this.colModel.columns.unshift(this.sm);


As my code renders the grid, the selectbox is the second column. Even if unshift() should push it to the first index. I tried it with a ordinary column object to.. It becomes also only the second one.

But why?

anfla
24 Sep 2013, 2:32 AM
Another approach, but same story. Could there be a special reason to prefer the "name" column in my grid?



var sm = new Ext.grid.CheckboxSelectionModel({singleSelect: false});
var initialConfig = {
sm: sm,
colModel: new Ext.grid.ColumnModel({
columns: [
sm,
{
header: _("Name"),
sortable: false,
dataIndex: "name",
id: "name"
},{
header: _("Path"),
width: 450,
sortable: false,
dataIndex: "path",
id: "path"
},{
header: _("Mode"),
sortable: false,
dataIndex: "mode",
id: "mode"
}]
})
};


Edit:

If I remove the "name" column, the checkbox column becomes the first one.