Vitaly Zakharenko
Vitaly Zakharenko

Reputation: 75

JQuery Datatables Responsive extension: column class not retained for cells in expanded rows

I am using columnClass property to assign different rendering (and event processing) to cells belonging to different columns.

When the table fits within the screen every element gets the class as specified by the columnClass property of its column and I can easily hook some rendering/processing functions to the elements.

However, when some of the columns don't fit within the page and I expand the row (by clicking the '+' button) the cells are renedered with no reference to the class of the column. I reviewed the custom renderer for the cells of the expanded columns and also see no way finding out what the column class of a cell is.

Ideally, I would like to use the same custom field renderer as defined in the table. Is there a way I can do it?

Example:

Let's say I have 3 columns: name, dob, salary.

I defined 3 classes for the columns: name_class, dob_class, salary_class.

For each class I use a jquery selector and assign diffrerent rendering/behavior for each cell of that column.

Now, I resize the table so that dob and salary get overflown and click on the '+' button to expand the row of interest.

I would expect to get the dob cell with the dob_class attribute and salary cell with the salary_class attribute, so I am able to link the same cell renderer to them.

However, ****the class attribute is no assigned (not retained) and I cannot link with jquery using the class attribute. ****

**Could you please suggest an solution that would allow me to retain the column class on the cells of the expanded row? **

Upvotes: 0

Views: 39

Answers (1)

colin0117
colin0117

Reputation: 1542

Sorry, no, that's not currently possible. It has been raised against the code already, see https://github.com/DataTables/Responsive/issues/93, so it is on the todo list. I'm not sure why the OP has been voted down, seems a bit unfair to me, as it is a valid question.

Upvotes: 1

Related Questions