Forum
07:48
17/02/2014
i'm very confuse why my table cannot work when i use "loadonce" set to be "true"
my problem is
-
when i use loadonce to be true ,searching will be work,but paging not work
-
but when i change loadonce to be false,searchong can't work,but paging work
i hope solutions for my problem
this is my code
<script type="text/javascript"> $(document).ready(function(){ var grid_selector = "#grid-table"; var pager_selector = "#grid-pager"; jQuery(grid_selector).jqGrid({ url: 'ajax_blok/data.php', datatype: "json", height: "auto", mtype: "GET", colNames: ['ID','Nama Blok','Action'], colModel: [ { name:'id', key:true, fixed:true, search:true, index:'id', editable:false, editrules:{required:true}}, {name:'name', index:'namablok', fixed:true,search:true, editable:true, editrules:{required:true} }, {name: 'myac', width:80, fixed:true, sortable:false, search:false, align:'center', viewable: false, resizable: false, resize:false, formatter:'actions', formatoptions: { keys:true,editbutton: true, delbutton: true, } }, ], pager: jQuery('#grid-pager'), rownumbers:true, rowNum:10, width:'auto', height:200, gridview: true, multiselect: true, sortorder:'desc', rowList:[10,20,30], multiboxonly: true, loadonce: true, autoencode: true, editurl: "ajax_blok/crud.php", viewrecords: true, sortname: "idblok", caption: "Record Test", }); jQuery(grid_selector).jqGrid('filterToolbar', { stringResult: false,searchOnEnter : false, defaultSearch: 'cn', ignoreCase: true}); jQuery(grid_selector).jqGrid('filterToolbar', { defaultSearch:true,stringResult:true}) function aceSwitch( cellvalue, options, cell ) { setTimeout(function(){ $(cell) .find('input[type=checkbox]') .wrap('<label class="inline" />') .addClass('ace ace-switch ace-switch-5') .after('<span class="lbl"></span>'); }, 0); } //enable datepicker function pickDate( cellvalue, options, cell ) { setTimeout(function(){ $(cell) .find('input[type=text]') .datepicker({format:'yyyy-mm-dd' , autoclose:true}); }, 0); } //navButtons jQuery(grid_selector).jqGrid('navGrid',pager_selector, { //navbar options edit: true, editicon : 'icon-pencil blue', add: true, addicon : 'icon-plus-sign purple', del: true, delicon : 'icon-trash red', search: true, searchicon : 'icon-search orange', refresh: true, refreshicon : 'icon-refresh green', view: true, viewicon : 'icon-zoom-in grey', }, { //edit record form //closeAfterEdit: true, recreateForm: true, beforeShowForm : function(e) { var form = $(e[0]); form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') style_edit_form(form); } }, { //new record form closeAfterAdd: true, recreateForm: true, viewPagerButtons: false, beforeShowForm : function(e) { var form = $(e[0]); form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') style_edit_form(form); } }, { //delete record form recreateForm: true, beforeShowForm : function(e) { var form = $(e[0]); if(form.data('styled')) return false; form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') style_delete_form(form); form.data('styled', true); }, onClick : function(e) { alert(1); } }, { //search form recreateForm: true, afterShowSearch: function(e){ var form = $(e[0]); form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') style_search_form(form); }, afterRedraw: function(){ style_search_filters($(this)); } , multipleSearch: true, }, { //view record form recreateForm: true, beforeShowForm: function(e){ var form = $(e[0]); form.closest('.ui-jqdialog').find('.ui-jqdialog-title').wrap('<div class="widget-header" />') } } ) function style_edit_form(form) { //enable datepicker on "sdate" field and switches for "stock" field form.find('input[name=sdate]').datepicker({format:'yyyy-mm-dd' , autoclose:true}) .end().find('input[name=stock]') .addClass('ace ace-switch ace-switch-5').wrap('<label class="inline" />').after('<span class="lbl"></span>'); //update buttons classes var buttons = form.next().find('.EditButton .fm-button'); buttons.addClass('btn btn-small').find('[class*="-icon"]').remove();//ui-icon, s-icon buttons.eq(0).addClass('btn-primary').prepend('<i class="icon-ok"></i>'); buttons.eq(1).prepend('<i class="icon-remove"></i>') buttons = form.next().find('.navButton a'); buttons.find('.ui-icon').remove(); buttons.eq(0).append('<i class="icon-chevron-left"></i>'); buttons.eq(1).append('<i class="icon-chevron-right"></i>'); } function style_delete_form(form) { var buttons = form.next().find('.EditButton .fm-button'); buttons.addClass('btn btn-small').find('[class*="-icon"]').remove();//ui-icon, s-icon buttons.eq(0).addClass('btn-danger').prepend('<i class="icon-trash"></i>'); buttons.eq(1).prepend('<i class="icon-remove"></i>') } function style_search_filters(form) { form.find('.delete-rule').val('X'); form.find('.add-rule').addClass('btn btn-small btn-primary'); form.find('.add-group').addClass('btn btn-small btn-success'); form.find('.delete-group').addClass('btn btn-small btn-danger'); } function style_search_form(form) { var dialog = form.closest('.ui-jqdialog'); var buttons = dialog.find('.EditTable') buttons.find('.EditButton a[id*="_reset"]').addClass('btn btn-small btn-info').find('.ui-icon').attr('class', 'icon-retweet'); buttons.find('.EditButton a[id*="_query"]').addClass('btn btn-small btn-inverse').find('.ui-icon').attr('class', 'icon-comment-alt'); buttons.find('.EditButton a[id*="_search"]').addClass('btn btn-small btn-purple').find('.ui-icon').attr('class', 'icon-search'); } function beforeDeleteCallback(e) { var form = $(e[0]); if(form.data('styled')) return false; form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') style_delete_form(form); form.data('styled', true); } function beforeEditCallback(e) { var form = $(e[0]); form.closest('.ui-jqdialog').find('.ui-jqdialog-titlebar').wrapInner('<div class="widget-header" />') style_edit_form(form); } }); </script>
11:04
Moderators
30/10/2007
Hello,
When this option is on you should provide all the data from the server and not 10 records as you do maybe.
With other words the response from the server should contain more that 10 records.
Regards
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
40 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66