Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data size limit for display on jqgrid

This is a follow-up to my earlier question posted here. I have cases where we get large amount of data, around 200KB to be displayed on the jqgrid. In such case, the last sets of data are never displayed. Each record is split by a newline character. The data is in this format:

{"data":{"data":"\tat org.aaa.aaa.aaa.aaa.aaa.aaa(aaa.java:512)[147:org.aaa.aaa.aaa:9.1.1]\n\tat aaa.aaa.aaa.aaa.aaa.aaa(aaa.java:1789)[146:org.aaa:9.1.1]\n"}}

The code for grid is as follows:

$("#grid").jqGrid({
    type: "GET", 
    url: "/getdata",
    datatype: "json",
    colNames: [''],
    colModel: [
       {name: 'data', align: 'left', sortable: false}
    ],
    jsonReader: {
        root: "data",
        cell: "",
        id: function () {
            return function () {
                return $.jgrid.randId();
            }
        },
        page: function() { return 1; },
        total: function() { return 1; },
        records: function(obj) { return obj.data.length; }
    },
    loadonce: false,
    viewrecords: true,
    sortname:'',
    rowNum: '9999',
    autowidth: true,
    ignoreCase: true,
    height: "auto",
    multiselect: false,
    sortable: false,
    autoencode: true,
    loadComplete: function() {
         $("tr.jqgrow:even").css("background", "#DDDDDC");
    },
    // We will handle the errors with ajax error handlers for now
    loadError: function(error){
        displayError(error.responseText);
    },
    beforeProcessing: function (data) {
         var items = data.data.split("\n"), i, l, item;
         data.logs = [];
         for (i = 0, l = items.length; i < l; i++) {
            item = $.trim(items[i]);
            if (item.length > 0) {
                data.data.push([item]);
             }
         }
    }
});

I tried setting the rowNum to '', 99999, nothing worked. The total number of lines wwas The same lines seem to be getting chopped from display in jqgrid. Is there any limit to the amount of data that jqgrid can display? As of now, no pagination has been implemented on jqgrid.

Any pointers are greatly appreciated.

thanks,

Asha

like image 789
Alice Avatar asked Nov 21 '25 19:11

Alice


1 Answers

First of all I recommend you to use correct type of all input parameters of jqGrid. In the documentation you will find the table which has "Type" column. The type of rowNum column is integer. So you should use rowNum: 9999 instead of rowNum: '9999'.

Additionally I strictly recommend you always use gridview: true option of jqGrid. In case of placing all data on one page such setting can improve the performance of filling of the grid in many times.

In the same way I don't recommend you to make any modification of the grid inside of loadComplete. It reduce the performance of jqGrid. You can define your custom CSS class for example

.myAltRows: { background: #DDDDDC }

and use the options altRows: true, altclass: "myAltRows". Alternatively you can use rowattr callback to set custom class or custom style on selected rows of the grid. See the answer for more details.

The last remark. I don't recommend you to include options which has default values (for example, type: "GET", loadonce: false, sortname:'', multiselect: false, sortable: false) or properties of colModel having default values (for example align: 'left'). You should examine default values column of the option and colModel options of the documentation.

like image 73
Oleg Avatar answered Nov 23 '25 09:11

Oleg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!