Hi,
I want to export only selected(cb: checked) rows to excel.
This works fine. However, after exporting data, it moves to page 1.
How can I avoid moving pages?
colModel: [
{ dataIndx: "selectRow", maxWidth: 30, minWidth: 30, align: "center", resizable: false,
title: "",
menuIcon: false,
type: 'checkbox',
sortable: false,
editor: false,
dataType: 'bool',
copy: false,
cb: {
all: false,
header: true
}
},
...
],
selectionModel: { type: 'row' },
toolbar: {
items: [
{
type: "button",
label: 'export',
cls: 'btn btn-success my-1',
listener: function () {
let dateStr = $.datepicker.formatDate('yymmdd', new Date());
let format = 'xlsx';
if( this.Checkbox('selectRow').getCheckedNodes().length >= 1 ) { //If checked, export selected rows.
this.filter({
oper: 'replace',
rules: [{ dataIndx: "selectRow", condition: "equal", value: true}]
});
}
let blob = this.exportData({
sheetName: dateStr,
format: format,
render: false
});
if(typeof blob === "string"){
blob = new Blob([blob]);
}
this.filter({
oper: 'replace',
rules: [],
});
saveAs(blob, `${dateStr}.${format}`);
}
}
]
}