ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Grid not displaying all rows on initial load

Open mxreppy opened this issue 13 years ago • 6 comments

Hi, I've been having this issue for some time with the grid not displaying all rows of the first page of data, and I'm wondering what it is that we are doing wrong.

  • We are using serverside paging (the data set is large, up to 300k rows now and 85 columns, of which we are currently showing about 40)
  • The data loaded is only the page shown, so all limit/offset/sorting is delegated to the server.
  • User configuration options including page size, and sort are also stored on the server (per user), so some of the grid options are set by a user data ajax call, prior to the first data load ajax call.
  • if you page forward/back the full first page of data is shown.
  • after the server has delivered the data, I've tried invoking the rebuild grid dom service. It has seemed to work sometimes and not other times, so perhaps there is a timing issue with various ajax calls?
$domUtilityService.RebuildGrid( $scope.gridOptions.$gridScope, $scope.gridOptions.ngGrid);
  • What has worked, but it seems to slow down the initial render is to fill the grid display data with 200 dummy rows (the allowed page sizes are 10, 25, 50 and 200, so I chose 200 as the maximum, although it's not very workable) when the controller is initialized. This allows the row renderer to "believe" that it has a full set of data and the first page seems to load now reliably, but it feels like a horrible hack (and it's slow)

I'll try and build a plunkr but it's right now buried in a big controller :-( Here are what I think are the essential snippets

  • In the controller initialization function:

    $scope.gridOptions.data = 'displayItems';
    $scope.displayItems = [{accountName:'Loading'}];    
    for (var ix = 0; ix < 200; ix++) {
        $scope.displayItems.push({});
    }
    
  • In the server data ajax request:

    // apiGet is the get URL and config are the query params...
        $http.get(apiGet, config).success(function (data) {
    
        $scope.displayItems = data.GenPopData;
        $domUtilityService.RebuildGrid(
                $scope.gridOptions.$gridScope,
                $scope.gridOptions.ngGrid);
        }.error( etc)
    
  • So far as I can tell, this has been the same issue with 2.0.3, 2.0.4, 2.0.5 and the current state of 2.0.6

thanks for any help or advice!

mxreppy avatar May 13 '13 19:05 mxreppy

To update my own issue, it seems that calling

$domUtilityService.RebuildGrid

in a timeout 100msec after my data ajax call returns works to display the grid data without any hacky prefill of the data array

mxreppy avatar May 16 '13 20:05 mxreppy

Can you make a plunker for this? Is this fixed in the latest version? Thanks.

jonricaurte avatar Jul 04 '13 02:07 jonricaurte

closed, no response.

roblarsen avatar Aug 20 '13 13:08 roblarsen

Hello!

I faced with the similar issue, here is the plunker Calling $domUtilityService.RebuildGrid updates the grid, and clicking on the head row for sorting also fixes row number.

Could you please help with fixing this? Thanks!

pronskiy avatar Oct 30 '13 12:10 pronskiy

Can be fixed by using ng-grid-flexible-height plugin

pronskiy avatar Oct 30 '13 13:10 pronskiy

@pronskiy can you explain how you got the fix to work?

jamespsterling avatar Apr 25 '17 14:04 jamespsterling