How to set parameters in jqgrid?

I need to set parameters for Jqgrid as toppager, forceFit, for which "Can it be changed?" the value is set to No, so I'm tired of it, adding it this way.

jQuery(document).ready(function () {
    jQuery("#list").setGridParam({
        forceFit: true,
        toppager: true
    }).trigger("reloadGrid");
    jQuery("#list").jqGrid({
        url: '<%= Url.Action("GridData") %>',
        datatype: 'json',
        mtype: 'GET',
        colNames: ['Time', 'Description', 'Category', 'Type', 'Originator', 'Vessel'],
        colModel: [{
            name: 'Time',
            index: 'Time',
            width: 200,
            align: 'left'
        }, {
            name: 'Description',
            index: 'Description',
            width: 600,
            align: 'left'
        }, {
            name: 'Category',
            index: 'Category',
            width: 100,
            align: 'left'
        }, {
            name: 'Type',
            index: 'Type',
            width: 100,
            align: 'left'
        }, {
            name: 'Originator',
            index: 'Originator',
            width: 100,
            align: 'left'
        }, {
            name: 'Vessel',
            index: 'Vessel',
            align: 'left'
        }],
        pager: jQuery('#pager'),
        rowNum: 20,
        rowList: [10, 20, 50],
        sortname: 'Time',
        sortorder: "desc",
        viewrecords: true,
        hoverrows: false,
        gridview: true,
        emptyrecords: 'No data for the applied filter',
        height: 460,
        caption: 'Logbook Grid',
        //forceFit: true,
        width: 1200
    });
});

But it did not help. Can u pls let me know what exactly am i doing wrong or right for this?

+3
source share
2 answers

First of all, you are trying to set jqGrid parameters in relation to jQuery ("# ​​list"). setGridParam () before meshing (before jQuery ("# ​​list"). jqGrid ({...})).

jqGrid jqGrid setGridParam. , setGridParam, jqGrid http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options (. " ?" ).

forceFit: true, toppager: true jqGrid jqGrid:

jQuery(document).ready(function() {
    jQuery("#list").jqGrid({
        url: '<%= Url.Action("GridData") %>',
        datatype: 'json',
        mtype: 'GET',
        forceFit: true,
        toppager: true
        colNames:['Time', 'Description', 'Category', 'Type', 'Originator', 'Vessel'],
        ...
    });
});

CSS JS . , (. http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_to_install).

, jqGrid , .

+1

setGridParam , :

jQuery("#list").jqGrid(...).setGridParam(...)
0

Source: https://habr.com/ru/post/1742395/


All Articles