Skip to content
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

Support style classes in DataTable rows and cells #54

Open
zkauker opened this issue Nov 26, 2014 · 1 comment
Open

Support style classes in DataTable rows and cells #54

zkauker opened this issue Nov 26, 2014 · 1 comment
Assignees
Milestone

Comments

@zkauker
Copy link

zkauker commented Nov 26, 2014

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)

@gabor-farkas
Copy link

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
  • make sure to properly dispose listeners

... to be defined.

@gabor-farkas gabor-farkas self-assigned this Dec 29, 2014
@gabor-farkas gabor-farkas added this to the 0.0.13 milestone Jan 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants