Add property to DataTables,
Add property to DataTables,
cirora
Posts: 29Questions: 2Answers: 1
Hi,
I want to init columns outside $().DataTable. How can I do it?
My code:
COLONNE='{data:"first_name"},{data:"last_name"}'
var TABELLA = $('#example').DataTable( {
dom: 'C<"clear">Tlfrtip',
"columns":COLONNE
});
but it doesn't work.
I tried eval(COLONNE) and window[COLONNE] but nothing.
Help please
This discussion has been closed.
Replies
Hi,
maybe this way isn't right one.
Is it possible to retrieve
columns:[{data:values_1},{data:values_2}]
from the thead of the table???
The
COLONNE
variable is a string above, not a Javascript object. Remove quotes and it should work.Allan
Thanks for the answer,
I have this Error:
Errore: TypeError: aoColumns[srcCol] is undefined
Path: /media/js/jquery.dataTables.js
I tried
No one works. Other solutions?
is what you want.
See the
columns
documentation and the examples incolumns.data
.Allan
Thanks Allan,
it works.
Great.