0
    1. $("#jqgproduct").jqGrid('getGridParam', 'data').length;
    2. $("#jqgproduct").getGridParam("reccount");

我尝试了上述两种方式,但它显示 0 条记录,即使网格有 3 条记录,这是我的完整代码。请让我知道我哪里出错了

var colNames = ['Status',
            'Project Ref',
            'Name',
            'Customer',
            'CreatedBy',
        'Creation Date',
        'LastModified'];
        var colModel = [
            { name: 'ProductID', index: 'StatusId', align: 'left', width: 70 },
            { name: 'ProjectReference', index: 'ProjectReference', align: 'left', width: 100, formatter: 'showlink', formatoptions: { "baseLinkUrl": "/Order/Index"} },
            { name: 'Name', index: 'Name', align: 'left', width: 150, formatter: 'showlink', formatoptions: { "baseLinkUrl": "/Order/Index"} },
            { name: 'CustomerName', index: 'CustomerName', align: 'left', width: 150 },
            { name: 'Createdby', index: 'Createdby', align: 'left', width: 150 },
              { name: 'CreatedDate', index: 'CreatedDate', align: 'left', width: 100, formatter: 'date', formatoptions: { newformat: 'm/d/Y'} },
              { name: 'LastModified', index: 'LastModified', align: 'left', width: 100, formatter: 'date', formatoptions: { newformat: 'm/d/Y'} }
        ];
        var sortname = 'Id';
        var sortorder = 'desc';
        SetGrid('#jqgproduct', '', url, colNames, colModel, sortname, sortorder, -1);

 var numberOfRecords = $("#jqgproduct").jqGrid('getGridParam', 'data').length;
$("#jqgproduct").getGridParam("reccount");
4

1 回答 1

0

试试这个:

 var recCount=$( '#jqgproduct' ).jqGrid( 'getGridParam', 'reccount' );
于 2013-04-02T10:38:22.273 回答