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

td class = field name #28

Closed
ScottEAdams opened this issue Dec 12, 2013 · 1 comment
Closed

td class = field name #28

ScottEAdams opened this issue Dec 12, 2013 · 1 comment
Milestone

Comments

@ScottEAdams
Copy link

In the same way that you add field name as the class for 'th' in the header it would be helpful for customising if each 'td' also had the field name as a class. I do it at the moment via confirm_datatable_options and aoColumnDefs but it sure would be nicer if it came for free :)

options.aoColumnDefs = [
        { "sClass": "field_name_0", "aTargets": [ 0 ] },
        { "sClass": "field_name_1", "aTargets": [ 1 ] },
        { "sClass": "field_name_2", "aTargets": [ 2 ] },
        { "sClass": "field_name_3", "aTargets": [ 3 ] },
etc
    ];

@tiliv
Copy link
Contributor

tiliv commented Jun 14, 2014

I have learned recently that datatables 1.10.0 supports a key called "DT_RowData", which is sent directly to the jQuery.data() function on the row to set data-* attributes on the <tr>. For the time being, I'm going to make this the official recommendation.

I think the easiest way to accomplish this is to update the view's row-level get_record_data(obj) method to add the "DT_RowData" key to the returned dict. In the future, I'd like to add an official hook on the view to more easily facilitate this.

@tiliv tiliv added this to the 1.0 milestone Jun 14, 2014
@tiliv tiliv modified the milestones: 1.0, 1.1 Oct 24, 2015
@tiliv tiliv closed this as completed Feb 28, 2017
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