Not sure if this is a bug or by design so marking it as a question for now…
When a drawer is toggled in a table, the tr element is decorated with the class ‘nx-item-has-drawer’ based on open/closed.
When the drawer is closed, the class is removed as part of the animation (slideup). When the drawer is opened, the class is applied outside of the animation (slidedown).
This results in the class always being on the tr element when a snippet is invoked from an action. The class is eventually removed when the animation is completed but depending on how tall the drawer is, processor speed, memory utilization, etc. there is no way to know how long it will take.
Does it make sense to put removeClass outside of slideUp similar to the way addClass is done outside of slideDown? This would provide a reliable method for 3rd parties to know drawer status without having to inspect internal data structures.
Possibly the removeClass inside of slideUp was done with a specific in reason in mind?
Thanks Barry.
I think the decision of when to add/remove the class had more to do with the styling effect, as its used primarily to apply certain CSS attributes to the table cells. Using its presence to determine the state of the drawer wasn’t really a consideration.
I agree that it makes sense to provide a mechanism for developers to easily discover the state of a particular drawer. For example, if a row has two different drawers, it’d be nice to know which of them are open. The nx-item-has-drawer class doesn’t provide this level of detail.
I’m going to re-categorize this post as an “Idea” for our team to consider in a future release.
Hi JD -
This makes a ton of sense, removing the class prior to the animation completing would change the styling of elements inside the drawer.
You nailed what I’m after though - and then some - a simple way to determine drawer state with the bonus of which drawer.
Thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.