JqGrid: enable paging when converting HTML table to grid

Everywhere it all concerned how to convert the html table to some kind of pagable and sortable, and I came across a jqGrid jquery plugin. So far, I have learned what we must call tableToGrid()to convert the table (which we pass as the jquery selector string for the method). I also tried many other things, for example, for example:

tableToGrid('#GridView1');

$('#GridView1').jqGrid({
    rowNum: 10,
    pager: '#pager',
    rowList: [10,20,30]
});

But all this does not give me the proper result. Is it possible to pager when we convert the html table to a grid?

+5
source share
1 answer

You should try

tableToGrid('#GridView1', {
    rowNum: 10,
    pager: '#pager',
    rowList: [10,20,30]
});

jqGrid tableToGrid. colModel jqGrid

var cm = myGrid.getGridParam("colModel");

.

: , edittype: "select".

for (var i = 0, l=cm.length; i < l; i += 1) {
    var colModelColumn = cm[i];
    // search for the clolumn with the name colModelColumnName.
    // variables colModelColumnName and selectedOptions are defined
    // in another code fragment above this one
    if (colModelColumn.name === colModelColumnName) {
        jQuery.extend(colModelColumn, { edittype: "select",
                                        editoptions: { value: selectedOptions }});
        break;
    }
}
+9

All Articles