简体   繁体   English

JQuery Datatables响应式扩展:扩展行中的单元格未保留列类

[英]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. 我正在使用columnClass属性将不同的呈现(和事件处理)分配给属于不同列的单元格。

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. 当表格适合屏幕时,每个元素都会获得其列的columnClass属性所指定的类,并且我可以轻松地将某些渲染/处理函数挂接到元素上。

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. 假设我有3栏:姓名,职位,薪水。

I defined 3 classes for the columns: name_class, dob_class, salary_class. 我为列定义了3个类: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. 对于每个类,我使用一个jquery选择器,并为该列的每个单元格分配不同的渲染/行为。

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. 我希望获得带有dob_class属性的dob单元格和带有salary_class属性的薪水单元格,因此我能够将相同的单元格渲染器链接到它们。

However, ****the class attribute is no assigned (not retained) and I cannot link with jquery using the class attribute. 但是,**** class属性未分配(不保留),并且我无法使用class属性与jquery链接。 **** ****

**Could you please suggest an solution that would allow me to retain the column class on the cells of the expanded row? **能否请您提出一个解决方案,使我可以将列类保留在扩展行的单元格上? ** **

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. 它已经针对代码提出过,请参见https://github.com/DataTables/Responsive/issues/93 ,因此它在待办事项列表中。 I'm not sure why the OP has been voted down, seems a bit unfair to me, as it is a valid question. 我不确定为什么OP被否决,对我来说似乎有点不公平,因为这是一个有效的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM