save/load state bugs out when selecting a date type filter
1. check 2 items from product then select an order date
2. save state
3. load state
4. product filter resets
HTML
<script src="http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/generatedata.js"></script>
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.base.css">
<link rel="stylesheet" href="http://jqwidgets.com/public/jqwidgets/styles/jqx.energyblue.css">
<script src="http://jqwidgets.com/public/jqwidgets/jqx-all.js"></script>
<div id='jqxWidget'>
<div id="jqxgrid"></div>
</div>
<div style="margin-top: 30px;">
<input type="button" id="saveState" value="Save State" />
<input type="button" id="loadState" value="Load State" />
</div>
JavaScript
var data = generatedata(500);
var filters;
var state = null;
var source = {
localdata: data,
datafields: [{
name: 'lastname',
type: 'string'
}, {
name: 'productname',
type: 'string'
}, {
name: 'date',
type: 'date'
}, {
name: 'quantity',
type: 'number'
}, {
name: 'price',
type: 'number'
}],
datatype: "array"
};
var adapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").on('bindingcomplete', function () {
if (state) {
$("#jqxgrid").jqxGrid('loadstate', state);
} else {
$("#jqxgrid").jqxGrid('loadstate');
}
});
$("#jqxgrid").jqxGrid({
width: 500,
theme: 'energyblue',
source: adapter,
sortable: true,
showfilterrow: true,
filterable: true,
pageable: true,
pagesize: 10,
pagesizeoptions: [5, 10, 25, 50],
columns: [{
text: 'Product',
datafield: 'productname',
width: 170,
filtertype: 'checkedlist'
}, {
text: 'Order Date',
datafield: 'date',
width: 160,
filterType:'date',
cellsformat: 'dd-MMMM-yyyy'
}, {
text: 'Quantity',
datafield: 'quantity',
width: 80,
cellsalign: 'right'
}, {
text: 'Unit Price',
datafield: 'price',
cellsalign: 'right',
cellsformat: 'c2'
}]
});
$("#saveState").jqxButton({
theme: 'energyblue'
});
$("#loadState").jqxButton({
theme: 'energyblue'
});
$("#saveState").click(function () {
// save the current state of jqxGrid.
state = $("#jqxgrid").jqxGrid('savestate');
});
$("#loadState").click(function () {
// load the Grid's state.
if (state) {
$("#jqxgrid").jqxGrid('loadstate', state);
} else {
$("#jqxgrid").jqxGrid('loadstate');
}
});