angular-ui/ui-grid

After scrolling down > hide > show via ng-show toggle makes rows disappear until triggering scroll again

Open

#5,050 建立於 2016年2月1日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)JavaScript (5,395 star) (2,496 fork)batch import
grid-corehelp wanted

描述

I have a grid that has an ng-show directive on it. The grid loads fine and if I don't scroll, I can toggle the ng-show to hide the grid and show it again and everything works fine. But if I scroll down the grid and select a row, then toggle the visibility via ng-show, the rows disappear until I trigger scrolling via mouse wheel. I have tried:

  • saving state and restoring it
  • scrollTo selected entity
  • refreshing grid
  • calling notifyDataChanged

And all have failed to make the grid behave appropriately in showing the last "viewport" that was there before toggling ng-show.

My grid options are as follows:

appScopeProvider: this, flatEntityAccess: true, minRowsToShow: 5, rowHeight: 27, enableColumnMenus: false, enableRowSelection: true, enableFullRowSelection: true, modifierKeysToMultiSelect: true, enableSelectAll: false, enableSelectionBatchEvent: false, selectionRowHeaderWidth: 35, showGridFooter: true, enableColumnResizing: true, enableFiltering: false, infiniteScrollRowsFromEnd: 40, infiniteScrollUp: false, infiniteScrollDown: true, enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER, enableVerticalScrollbar: uiGridConstants.scrollbars.ALWAYS

I also have onRegisterApi declared as follows: onRegisterApi: function(gridApi) { vm.vmGridApi = gridApi; gridApi.selection.on.rowSelectionChanged(null, function (row) { vm.onGridsSelectionChanged(); }); gridApi.grid.registerRowsProcessor(vm.filterCurrentGrid); gridApi.infiniteScroll.on.needLoadMoreData(null, vm.fetchNextPageOfData); },

  • Row selection changed method just gets selected entity and sets it in variable on controller.
  • Register row processor uses single text input to filter rows (as per tutorial, no variation)
  • Need Load more data fetches next page of data for infinite scroll (as per tutorial, no variation)

Thank you in advance to all for assisting with this issue.

貢獻者指南