Custom className of Select Extension does not work

Custom className of Select Extension does not work

nemcuonnemcuon Posts: 16Questions: 6Answers: 1

Hi all,

I am using Angular-DataTable v0.4.3, and want to change the color of the selected items provided by Select Extension

From https://datatables.net/reference/option/select.className
$('#example').DataTable( {
select:
style: 'os',
className: 'row-selected'
}
} );

I understand that I could set the class name by

dtOptions : DTOptionsBuilder.newOptions().withOption('select', {className: 'myCustomClassName'})

, however this does not work: by inspecting I see that the selected item does not have any extra class: no 'selected' nor 'myCustomClassName'.

(But some days ago, I think I saw it working, I am not sure if my observation at that point was wrong, or I have changed something else after that (e.g. using one of the .js or .css files that is newer than the one that was working) ???

Any help is welcome.

Answers

  • nemcuonnemcuon Posts: 16Questions: 6Answers: 1
    edited June 2016

    I found the answer

    Possible reason why the documentations on both websites (jQuery based Datatables va Angular-Datatables) don't work for my Select Plugin/Extension:

    I use
    - v.0.4.3 of Angular-DataTables (a bit old)
    - latest documentation of Angular-DataTables
    - latest version of Select Extension and latest version of jQuery DataTables

    So my own solution is to use some undocumented feature of both (Angular and jQuery DataTables). Infact

    a) the following statements work

    .withOption('select', {style: 'os', className : 'myOwnClassName'})
    .withOption('select', true)

    b) the following statements don't work
    .withOption('select', {'myOwnClassName'})

This discussion has been closed.