-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
Grid list doesn't update tiles order change #769
Comments
Good find! Can think of 2 solutions, either's good to me: A) Make B) Order tiles by their dom position:
C) combination of both? I'm sure there's use cases for all 3 but it's hard to think of them off the top of your head haha |
D) Just use css grid |
I would think an optional order number property would be better, because it's direct ember and you don't have to worry about the render lifecycle by using jquery. |
Don't know if I fully understand the problem here, but this reminds me of a pattern I used in |
The scenario is if you have 3 tiles rendered 1, 2, 3. Then you change their order and render them 2, 1, 3. Even if you call updateGrid the order change isn't reflected because the childComponents order doesn't change. |
If there is an index number already on childComponents I agree it would be better to just do a computed property sort on it. I just noticed that the order of childComponents didn't change even if the render order was changed. |
The problem with adding the indexes to childComponents on register is that register/unregister is not called when components change order in the dom. (not an issue for tabs or steps as why would these be rearranged) e.g Tiles are originally rendered in order A, B, C. the index is set for each of them 0, 1, 2. When they are rearranged in the dom to B, C, A, ember doesn't destroy and recreate or even re render the tile components so register is never called again, neither are any of hooks on Also if tile D is added as the first tile in the dom, so we have D, B, C, A, when tile D is registered it is just added to the end of childComponents so order would still incorrectly be A, B, C, D. So the only way I can see to keep the index updated is either:
imo a combination would be best, dom scan for automatic ordering that can be overridden by a property on Maybe there's a simpler solution i'm overlooking ¯\_(ツ)_/¯ |
When the tiles change order the grid list doesn't update. I confirmed the order was changing in the dom, but the grid list wasn't updating. For a work around I gave tiles an orderNumber property and sorted them in the grid list. I'm happy to do a pull request if you are interested.
The text was updated successfully, but these errors were encountered: