Limiting the size of data to display on a jqgrid

This is a follow-up to my previous question posted here . I have cases where we receive a large amount of data, about 200KB, which will be displayed on the jqgrid. In this case, the latest data is never displayed. Each entry is separated 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 the grid looks like this:

$("#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 to set rowNum to ', 99999, nothing worked. The total number of lines wwas. These same lines seem to be shredded from the display in the jqgrid. Is there a limit to the amount of data a jqgrid can display? No pagination is currently implemented on jqgrid.

Any pointers would be greatly appreciated.

thank,

Asha

+3


source to share


1 answer


First of all, I recommend that you use the correct type for all jqGrid inputs. You will find a table with a column in the documentation"Type"

. The column type rowNum

is an integer. Thus, you should use rowNum: 9999

instead rowNum: '9999'

.

Also, I strongly recommend that you always use the option gridview: true

for jqGrid. If you put all your data on a single page, this can dramatically improve grid fill performance.

Likewise, I do not recommend making any changes to the mesh internally loadComplete

. This degrades the performance of jqGrid. You can define your own CSS class like



.myAltRows: { background: #DDDDDC }

      

and use the parameters altRows: true, altclass: "myAltRows"

. Alternatively, you can use a callback rowattr

to set a custom class

or custom one style

on the selected rows of the grid. For details see.

One last remark. I do not recommend including options that have default values ​​(for example type: "GET", loadonce: false, sortname:'', multiselect: false, sortable: false

) or properties colModel

that have default values ​​(for example align: 'left'

). You should check the default value column option and colModel

options
documentation.

+3


source







All Articles