Display the total number of rows in a Slickgrid ta

2019-07-08 05:10发布

问题:

Is there an accepted way to display the total number of rows in a slickgrid table. I see that there is a pager that I can include on my pages, but that comes with additional buttons/settings for pagination.

I am using a DataView object with no grouping. Ideally I'd like to simply have a trivial row at the bottom of the viewport that lists how many rows are in the table.

I could do this manually but wasn't sure if I was missing something in the Slickgrid APIs/configuration.

回答1:

Use this method...to get number of rows displayed in the grid..(if no pagination is there)

grid.getDataLength();

if pagination is there....use this..

grid.getData().getPagingInfo().pageNum
grid.getData().getPagingInfo().pageSize
grid.getData().getPagingInfo().totalPages
grid.getData().getPagingInfo().totalRows   //  what u want


回答2:

Use the onRowCountChanged for dataView argument in Slick Grid.

dataView.onRowCountChanged.subscribe(function (e,args)
{
   $("#RowCount").text(args.current);
});


标签: slickgrid