issue savestate with sortmode manyi
Invoke the savestate method of the jqxGrid. Author: http://jqwidgets.com
by mogador
HTML
<script src="https://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="https://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="https://jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<h2>savestate / LoadState does not work if grid is configured with sortmode: 'many'</h2>
Exemple : <br>
- sort grid with column [In Stock] and [Quantity]<br>
- clic on savestate<br>
- clear filters on columns [In Stock] and [Quantity]<br>
- sort grid on column [product]<br>
<br>
- clic on [Load State] : <br>
* it only applies filter [Quantity], <br>
* the filter [in Stock] is forgotten<br>
* and it keeps filter [Product]<br>
<br><br>
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid"></div>
<div style="margin-top: 30px;">
<input type="button" id="saveState" value="Save State" />
<input type="button" id="loadState" value="Load State" />
</div>
</div>
JavaScript
var data = generatedata(20);
var source = {
localdata: data,
datatype: "array",
datafields: [{
name: 'firstname',
type: 'string'
}, {
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'available',
type: 'bool'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
updaterow: function (rowid, rowdata) {
// synchronize with the server - send update command
}
};
var dataAdapter = new $.jqx.dataAdapter(source);
// initialize jqxGrid
$("#jqxgrid").jqxGrid({
width: 680,
source: dataAdapter,
theme: 'energyblue',
columnsresize: true,
editable: true,
sortmode: 'many',
sortable: true,
selectionmode: 'singlecell',
columns: [{
text: 'First Name',
columntype: 'textbox',
datafield: 'firstname',
width: 90
}, {
text: 'Last Name',
datafield: 'lastname',
columntype: 'textbox',
width: 90
}, {
text: 'Product',
datafield: 'productname',
width: 170,
}, {
text: 'In Stock',
datafield: 'available',
columntype: 'checkbox',
width: 125,
}, {
text: 'Quantity',
datafield: 'quantity',
width: 85,
cellsalign: 'right',
cellsformat: 'n2',
aggregates: ['min', 'max'],
}]
});
$("#saveState").jqxButton({
theme: 'energyblue'
});
$("#loadState").jqxButton({
theme: 'energyblue'
});
var state = null;
$("#saveState").click(function () {
// save the current state of jqxGrid.
state = $("#jqxgrid").jqxGrid('savestate');
});
$("#loadState").click(function () {
// load the Grid's state.
if (state) {
...