Showing posts with label jqGrid. Show all posts
Showing posts with label jqGrid. Show all posts

Thursday, 7 August 2014

How reloadAfterSubmit working in jqGrid 0

This reloadAfterSubmit attribute always confusing with data type. I have seen so many post related to reloadAfterSubmit not working like that in jqGrid forum and stackoverflow posts. Here I gave explanation about reload process in jqGrid.


  • jqGrid using AJAX to post data to Server Side (add, edit, delete). So, our page will not get refresh.
  • jqGrid reloadAfterSubmit : true will again load our data source to jqGrid.
  • So, If we set reloadAfterSubmit : true for JSON or XML dynamic data source, it will work. We can see updated data in jqGrid. Because, jqGrid again will get the updated data source from dynamic JSON or XML data type (data source).
  • If we set reloadAfterSubmit : true for local data, It will also work. But, We can't see any updated data in jqGrid. Because, our local data is static till we manually refresh our complete page. So, this reloadAfterSubmit : true will again load our declared local data.
So,
  • For local data data type, we should set reloadAfterSubmit : false.
  • For, JSON or XML data type, we should set reloadAfterSubmit : true.

Monday, 28 July 2014

Resize jqGrid based on number of rows 0

To resize grid based on number of rows, Just we need to say this in configuration settings of jqGrid.

Yes. we need to set like this below.

$("#mygrid").jqGrid({
    ...,
    ...,
    ...,
    height:'auto',
    ...,
    ...
});
 
simply set height property to auto.

How it actually works?

This height configuration for the body of the grid. Our grid table is actually placed within the body of the grid. We can get that body of the grid by this selector ".ui-jqgrid-bdiv".

So, If we not set height property in jqGrid configuration, It will take the default height to 150px. If we send one record to jqGrid, it will show like this below,


If we set height property to auto in jqGrid configuration settings, and we are sending only one record to grid. It will showing the grid like below,


So, If we sending more than 20 records, and we set our grid limit to 20 per page. So, Grid showing correctly showing 20 records in first page. See the below image.


Have any doubt? Feel free to comment here!!!


Thursday, 17 July 2014

Uncaught TypeError: Cannot read property 'integer' of undefined - jqGrid 0

This sounds "Language supporting file is missing".

* One get the error message typically if one don't included required language file grid.locale-xx.js (for example grid.locale-en.js).

* You can Include it before jquery.jqGrid.min.js or jquery.jqGrid.src.js. See the example of the usage of jqGrid in Documentation

* If you don't have that file, Click Here to download.

Have any doubt? Feel free to comment here!!!

Related post : jqGrid "reloadGrid" using Local Data (JSON Object)



Thursday, 20 March 2014

jqGrid "reloadGrid" using Local Data (JSON Object) 0

In jqGrid they are using .trigger('reloadGrid'); to reload the grid like below,

$('#gridID').trigger('reloadGrid');

If you are using Local data, you should mention your Local Json Data in jqGrid's
setGridParam property and you can use jqGrid's loadComplete event handler to do this like below,

loadComplete: function () {
    jQuery("#grid1")
        .jqGrid('setGridParam', {
        datatype: 'local',
        data: dynaData2 //json object
    })
        .trigger("reloadGrid");
}

See this Stackoverflow answer post.

And also read this jqGrid Documentation