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

changing ColumnDefs does not consistently apply them

Open zdol opened this issue 10 years ago • 5 comments

I have a situation where I need to change data for the grid, and for each set of data I set new columnDefs like:

$scope.gridOptions.data = newData;
$scope.gridOptions.columnDefs = newColumnDefs;

This way, I can:

  • show or hide Columns
  • set their width and their presentation order

But, if I change the width of Column X and then try to load some newColumnDefs the column width will remain unchanged and not match the one in the newColumnDefs. Any consequent changes to columnDefs will not affect the width of Column X.

Moreover, if the columnDefs include column sorting information, these load fine the first time columnDefs is assigned, but any consequent changes leave the sorted column(s) unchanged - other attributes like width, visibility, order etc are applied upon loading some newColumnDefs but sorting is ignored.

Are those bugs? Are those not implemented yet? Am I doing something completely wrong? Anyone has any idea how to get over it? I could even dig into code and see what I can do myself, if I had any hints.

Plunkr with directions on how to reproduce the issues: http://plnkr.co/edit/4By8lEX9jOB6soLrzyAY?p=preview

zdol avatar Jun 02 '16 18:06 zdol

Have thought about using 3 different grids for this? Although I recognise that performance wise it might be not the best solution.

bjaraujo avatar Jun 08 '16 09:06 bjaraujo

Separate grids might work for the example in the Plunkr, but it would not be a viable solution if I have too many data sets, or even an unknown or changing-over-time number.

Does anyone know if there is a method to rebuilt/reinitinialize/reset the grid? It seems I cannot find anything in the docs.

Also, could someone answer if this is a bug or an error in my logic/implementation?

zdol avatar Jun 08 '16 15:06 zdol

+1 Same issue here with dynamic column defs

jgunderson-IAS avatar Oct 03 '16 18:10 jgunderson-IAS

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar May 23 '18 04:05 stale[bot]

This issue has been automatically closed because it has not had recent activity. If you believe that this is still an issue in the latest version, feel free to re-open it. Thank you for your contributions.

stale[bot] avatar Jun 22 '18 05:06 stale[bot]