You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In many cases make sense to add CSS classes to table TRs and/or TDs - especially if the style class should be determined by the contained data (example: in a todo list highlight the rows which have high priority)
The text was updated successfully, but these errors were encountered:
Things are a bit difficult. BaseComponent contains many model fields and builder methods that provide basic functionality that can apply to any html element, but we cannot make everything a BaseComponent because that'd boost memory footprint quite a lot in case of a datatable for example. Now that we need a "part" of basecomponent functionality for table rows and cells, we have to use composition instead of inheritance.
Model
add a styleclasses list in DataTableCellModel and DataTableRowModel. It should be null by default. Create a HasStyleClasses interface and BaseComponentModel should also implement that (with the getter and setter).
Builder
create a StyleClassesBuilder class that takes a HasStyleClasses as a constructor parameter and provides addStyleClass, bindStyleClassPresent, removeStyleClass, as seen in BaseComponent. Create an instance of this class in BaseComponent and make the above three methods delegates to this styleclassesbuilder instance.
... the way to use this builder for cells and rows is yet to be defined.
Renderer
based on the styleClasses listener in BaseComponentRenderer, create an individual class called StyleClassesRenderer that takes the list binding as the first and the JQuery widget as the second constructor parameter.
make it implement the ListenerRegistration interface, so that it can be disposed.
use these classes in the renderRow method in DataTableRenderer
In many cases make sense to add CSS classes to table TRs and/or TDs - especially if the style class should be determined by the contained data (example: in a todo list highlight the rows which have high priority)
The text was updated successfully, but these errors were encountered: