Insert column at the first position in grid #5799
-
I am trying to insert row selection at the first position of grid but it always ends up among hidden columns. I did the same thing with delete button column and it worked just fine. `protected getColumns(): Slick.Column[] {
The problem is not incorrect implementation of selection row. I know that because I tried it with different columns with same results. I also tried to set "visible" to true |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
The problem was that persistence of data was turned on with this function
|
Beta Was this translation helpful? Give feedback.
-
This code will make your selection column stay at first position protected getPersistedSettings() {
let setting = super.getPersistedSettings();
let idCol = Q.tryFirst(setting.columns, x => x.id == "__select__");
if (idCol) {
setting.columns.splice(setting.columns.indexOf(idCol), 1);
setting.columns.splice(0, 0, idCol);
}
return setting;
} But make sure that the selection is not in hidden list |
Beta Was this translation helpful? Give feedback.
-
protected getColumns(): Slick.Column[] {
var cols = super.getColumns();
cols.splice(0, 0, {
field: 'Delete Row',
name: '',
format: ctx => '<a class="inline-action delete-row" title="delete">' +
'<i class="fa fa-trash-o text-red"></i></a>',
width: 24,
minWidth: 24,
maxWidth: 24,
visible: true
});
cols.splice(1, 0, Serenity.GridRowSelectionMixin.createSelectColumn(() => this.rowSelection));
return cols; |
Beta Was this translation helpful? Give feedback.
This code will make your selection column stay at first position
But make sure that the selection is not in hidden list