Row that is marked drawer not open still has nx-item-has-drawer

  • 1
  • Idea
  • Updated 4 years ago
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?
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb

Posted 4 years ago

  • 1
Photo of JD Bell

JD Bell, Senior Product Engineer

  • 2,996 Points 2k badge 2x thumb
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.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,076 Points 10k badge 2x thumb
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!