-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Moved columns reset when new column added #4254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I noticed that this is verify similar to #4188. It looks like no matter what, we are overriding our current grid layout/config with our column defs... which seems silly to me. Does anyone know why we would want to do that? [edit]: My issue is actually fixed by #4005, but this issue is not. Sorry for the spam. |
@ingshtrom, you are correct that does appear to be the same issue. The design intent behind the current system is that gridOptions, and thus columnDefs are defined by the application developer, and should not be modified by user interaction (unless the application developer explicitly allows it). I am very hesitant to change this. I haven't looked in detail at options for dealing with this issue, but my first thought is that features which override columnDefs should use the In this particular case, as well as in the issue with column width, the current state is saved on saveState is currently simple and works very well for it original intended use, but I think a refactor to become more of a pubsub type system would be good. That way it doesn't need to know about all of other features, those features can register themselves and listen for save and restore events. |
This seems to pre-date that PR. I can reproduce it on RC19 and RC22. |
Cache the column order when columns are moved, and restore that order using a dataChangeCallback. Fixes angular-ui#4254
I also encountered this problem in a similar way because i use an asyn call to create the columns (returned by the server). See my plunk
However, if you do a "restore" in a $timeout, as shown with button "Restore ok", it works. The reason behind this:
The consequence is to use a $timeout after changing columnDefs to restore the columns. |
If columns are reordered (moved) by the user, then a new column is added to the grid, all columns return to their original position when
notifyDataChange
is called.http://plnkr.co/edit/k27uZeIOr8NEmuq66KWV?p=preview
The text was updated successfully, but these errors were encountered: