Darrel
|
 |
« on: November 16, 2015, 11:55:15 PM » |
|
Hello, I'm want to use the datagrid control to load data from the database. However before trying the same I decided to use static values and go ahead based on the results. However I faced an issue. Whenever the grid is getting loaded the web page on the browser hangs for a few seconds. Also the grid takes a long time to be displayed on the browser. Later i made use of filters over the grid columns, but to filter through these sample 20 entries, it takes a lot of time, nearly 10-15 seconds.... Files i've included for the sample code. <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
Code written inside the body tag..... <table id="dg" title="DataGrid" style="width:700px;height:380px" data-options=" singleSelect:true,rownumbers:true,pageSize:50,pagination:true, data:data "> <thead> <tr> <th data-options="field:'client',auto:true,sortable:true">Client Code</th> <th data-options="field:'name',auto:true,sortable:true,editor:'textbox'">Client Name</th> <th data-options="field:'testcode',auto:true,align:'right',sortable:true">Test Code</th> <th data-options="field:'testname',auto:true,sortable:true,editor:'textbox'">Test Name</th> <th data-options="field:'indexNo',auto:true,align:'center',sortable:true,editor:'textbox'">indexNo</th> <th data-options="field:'other_code',auto:true,align:'center',sortable:true">Other Code</th> <th data-options="field:'date1',auto:true,align:'center',sortable:true">Appl date</th> <th data-options="field:'qty',auto:true,align:'center',sortable:true,editor:{type:'numberbox',options:{precision:1}}">Qty</th> <th data-options="field:'costvalue',auto:true,align:'center',sortable:true,editor:{type:'numberbox',options:{precision:1}}">Cost Value</th> <th data-options="field:'moneypaid',auto:true,align:'center',sortable:true">Money Paid</th> <th data-options="field:'date2',auto:true,align:'center',sortable:true">Date 2</th> <th data-options="field:'remarks',auto:true,align:'center',sortable:true,editor:'textbox'">Remarks</th> </tr> </thead> </table> <script type="text/javascript" src="js/jquery-easyui-1.4.3/datagrid-filter.js"></script> <script type="text/javascript"> //for simplicity sake i've used only 20 entries. However in real life scenario there would definitely be more records
var data = [ {"client":"ABCD","name":"ABCD","testcode":"ABCDEF08","testname":"asdadUasdasd","indexNo":"INF066A19020","other_code":"","date1":"29/10/2012","qty":"0","costvalue":"15.48","moneypaid":"0","date2":"-","remarks":"REMARKS : "}, {"client":"DEFG","name":"DEFG","testcode":"FRCT101","testname":"asdadUasdasd","indexNo":"F20000000001","other_code":"","date1":"29/10/2012","qty":"2","costvalue":"10","moneypaid":"20","date2":"29/10/2012","remarks":"REMARKS : "}, {"client":"HIJK","name":"HIJK","testcode":"UNHDFC01","testname":"asdadUasdasd","indexNo":"INF066H19068","other_code":"","date1":"30/11/2012","qty":"100","costvalue":"1","moneypaid":"100","date2":"-","remarks":"REMARKS : "}, {"client":"LMNO","name":"LMNO","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"10/08/2011","qty":"0","costvalue":"10000000","moneypaid":"50000000","date2":"22/11/2007","remarks":"REMARKS : "}, {"client":"PQRS","name":"PQRS","testcode":"INFOSYS","testname":"asdadUasdasd","indexNo":"INE009A01020","other_code":"","date1":"10/07/2011","qty":"10","costvalue":"5","moneypaid":"50","date2":"-","remarks":"REMARKS : "}, {"client":"TUVW","name":"TUVW","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"01/09/2011","qty":"10","costvalue":"10000000","moneypaid":"100000000","date2":"22/11/2007","remarks":"REMARKS : "}, {"client":"XYZA","name":"XYZA","testcode":"EQCOAL","testname":"asdadUasdasd","indexNo":"IN99292A1091","other_code":"","date1":"10/09/2011","qty":"3400","costvalue":"10","moneypaid":"34000","date2":"-","remarks":"REMARKS : "}, {"client":"BCDE","name":"BCDE","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"10/08/2011","qty":"100","costvalue":"10000000","moneypaid":"1000000000","date2":"22/11/2007","remarks":"REMARKS : "}, {"client":"FGHI","name":"FGHI","testcode":"FRCT101","testname":"asdadUasdasd","indexNo":"F20000000001","other_code":"","date1":"29/10/2012","qty":"10","costvalue":"10","moneypaid":"100","date2":"29/10/2012","remarks":"REMARKS : "}, {"client":"JKLM","name":"JKLM","testcode":"ALSTFC65","testname":"asdadUasdasd","indexNo":"INE721A07BA8","other_code":"","date1":"14/07/2011","qty":"100","costvalue":"1000","moneypaid":"100000","date2":"13/07/2011","remarks":"REMARKS : "}, {"client":"NOPQ","name":"NOPQ","testcode":"EQCOAL","testname":"asdadUasdasd","indexNo":"IN99292A1091","other_code":"","date1":"10/09/2011","qty":"10000","costvalue":"10","moneypaid":"100000","date2":"-","remarks":"REMARKS : "}, {"client":"RSTU","name":"RSTU","testcode":"EQCOAL","testname":"asdadUasdasd","indexNo":"IN99292A1091","other_code":"","date1":"10/09/2011","qty":"3000","costvalue":"15.48","moneypaid":"10","date2":"-","remarks":"REMARKS : "}, {"client":"ABCD","name":"ABCD","testcode":"ABCDEF08","testname":"asdadUasdasd","indexNo":"INF066A19020","other_code":"","date1":"29/10/2012","qty":"0","costvalue":"15.48","moneypaid":"0","date2":"-","remarks":"REMARKS : "}, {"client":"DEFG","name":"DEFG","testcode":"FRCT101","testname":"asdadUasdasd","indexNo":"F20000000001","other_code":"","date1":"29/10/2012","qty":"2","costvalue":"10","moneypaid":"20","date2":"29/10/2012","remarks":"REMARKS : "}, {"client":"HIJK","name":"HIJK","testcode":"UNHDFC01","testname":"asdadUasdasd","indexNo":"INF066H19068","other_code":"","date1":"30/11/2012","qty":"100","costvalue":"1","moneypaid":"100","date2":"-","remarks":"REMARKS : "}, {"client":"LMNO","name":"LMNO","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"10/08/2011","qty":"0","costvalue":"10000000","moneypaid":"50000000","date2":"22/11/2007","remarks":"REMARKS : "}, {"client":"PQRS","name":"PQRS","testcode":"INFOSYS","testname":"asdadUasdasd","indexNo":"INE009A01020","other_code":"","date1":"10/07/2011","qty":"10","costvalue":"5","moneypaid":"50","date2":"-","remarks":"REMARKS : ","row_qty_prcsn":"0"}, {"client":"TUVW","name":"TUVW","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"01/09/2011","qty":"10","costvalue":"10000000","moneypaid":"100000000","date2":"22/11/2007","remarks":"REMARKS : "}, {"client":"XYZA","name":"XYZA","testcode":"EQCOAL","testname":"asdadUasdasd","indexNo":"IN99292A1091","other_code":"","date1":"10/09/2011","qty":"3400","costvalue":"10","moneypaid":"34000","date2":"-","remarks":"REMARKS : "}, {"client":"BCDE","name":"BCDE","testcode":"ALACEG14","testname":"asdadUasdasd","indexNo":"INPYALACEG14","other_code":"","date1":"10/08/2011","qty":"100","costvalue":"10000000","moneypaid":"1000000000","date2":"22/11/2007","remarks":"REMARKS : "}, ]; $(function(){ var dg = $('#dg').datagrid({ remoteFilter: false, pagination: true, pageSize: 10, pageList: [10,20,50,100] }); dg.datagrid('enableFilter'); dg.datagrid('loadData', data);
function showFilters(){ dg.datagrid('enableFilter', [{ field:'qty', type:'numberbox', options:{precision:1}, op:['equal','notequal','less','greater'] },{ field:'costvalue', type:'numberbox', options:{precision:1}, op:['equal','notequal','less','greater'] },{ field:'moneypaid', type:'numberbox', options:{precision:1}, op:['equal','notequal','less','greater'] }]); }
showFilters(); }); </script>
Now, I also get the error now whenever I filter or click on the pagination links to go to another page in the grid (Possibly because I previously was having around 220 records in the javascript data objec!): "SCRIPT28: Out of stack space datagrid-filter.js, line 592 character 4" Fiddle link for the same example: http://jsfiddle.net/DROCKS/pee6bx62/4/ Any help would be appreciated. Thanks in advance... Regards, Darrel Viegas.
|