Dynamically change names in ColVis - Reinit
Dynamically change names in ColVis - Reinit
Regarding this topic:
https://datatables.net/forums/discussion/31748/dynamic-column-names-in-colvis-buttons
There is a solution to change the text of one line manually. But as in the topic meant, how is it possible to reinitalize Colvis after changing dynamically Column Names in Table Header. Is there a function to reinitialize colvis, sothat it greps all of the current columns.
Or maybe to delete the entries and add new entries by Class Name.
Answers
Sorry, I'm not clear what the issue is. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Sorry. I will try to explain:
Here, i changed the column text manually, like in other thread described:
table.columns( ".changetext" ).every( function(idx, t,i){
$(this.header()).text("Feld "+ (i+1) )
})
While i do this, i also want to change the text in the Colvis Dropdown.
The Dropdown-Menu will be generated on click and takes the title of the column, which is being defined on initialisation.
The question is, how to access the column-settings to update the "title" attribute.
I see, that's only changing the text in the HTML so, yep, DataTables wouldn't know about it. You would need to make that change when the table is being initialised for the
column.title
,Colin
Thank you.
Is there any possibility to change the column.title after initialization and to re-render the table then? So that there is some dynamically solution for that.
Yep, that is possible, you can use the
colvis
columnText
option to label the columns - something like this -Colin