Hi,
I have one other bug to report on saveState/loadState (otherwise it works great). When spanning table columns, the formatter is lost after a loadState followed by filterToolbar search. Please run this example:
Here is an example:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
<button onClick="savegrid();">Save Search</button> <button onClick="loadgrid();">load Search</button> <button onClick="resetgrid();">Reset</button> <table id="jqGrid"></table> <div id="jqGridPager"></div> <script type="text/javascript"> var mydata = [ { id: "1", prefix: "Mr.", first: "John", middle: "M.", last: "Smith", city: "Boston", namefull: "Mr. John M. Smith" }, { id: "2", prefix: "Ms.", first: "Mary", middle: "L.", last: "Jones", city: "Chicago", namefull: "Ms. Mary L. Jones" }, ]; $(document).ready(function () { $("#jqGrid").jqGrid({ datatype: "local", data: mydata, height: 250, width: 780, colModel: [ { label: 'ID', name: 'id', width: 75, key:true },{ label: 'Prefix', name: 'prefix', width: 80, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' colspan=4' }, formatter: function(value, options, rData){ return rData['namefull']; }, },{ label: 'First', name: 'first', width: 100, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' style=\"display:none\"' }, },{ label: 'Middle', name: 'middle', width: 80, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' style=\"display:none\"' }, },{ label: 'Last', name: 'last', width: 100, cellattr: function (rowId, tv, rawObject, cm, rdata) { return ' style=\"display:none\"' }, },{ label: 'City', name: 'city', width: 100, }, ], viewrecords: true, caption: "Save Grid State", storeNavOptions : true, }); $("#jqGrid").jqGrid('filterToolbar',{ searchOperators: true, autosearch: true, }); }); function savegrid() { $.jgrid.saveState("jqGrid"); } function loadgrid() { $.jgrid.loadState("jqGrid", null, {}); } function resetgrid() { window.location.reload(true); } </script> |
Thanks for your help,
Walter Hardy
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top