Is it possible to recreate some columns of a datatable ?
Is it possible to recreate some columns of a datatable ?
ningollan
Posts: 6Questions: 2Answers: 0
Hi everyone,
Here is my problem :
- I work in server side mode
- My datatables contains some columns for a kind of product
I would like to update the columns of my datatable because some of them are not the same for two kind of products.
Example :
Product 1 : columnA,columnB,columnC,columnF
Product 2 : columnA,columnD,columnE,columnF
Is it possible to do it ?
Thanks for your help.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Not sure I'm clear on exactly what you want to do. Maybe
columns.render
is what you want to use?If that doesn't help maybe you can be more specific with your question by providing examples of your data and what you want to do. The best option would be a test case showing your datatable with a few examples of your data and a description of what you want to do.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Hi @kthorngren ,
Thanks for your answer, but it's not this, i will try to explain it better :
I have a form, in this form there is a field that define the type of product i have (ie : alcohol, soda...).
When i submit the form, on the server side, i check what type of product it is, and then i define a list of column for my datatables.
That's why i have different columns for the same datatables.
I would like to refresh the columns of my datatables according to my type of product.
Is it possible ?
Example :
- For alcohol i have three columns : columnAlcohol1, columnAlcohol2, column3
- For Soda i have four columns : columnSoda1, columnSoda2, column3, column4
The easiest solution might be to put all of the columns you need in the table, then use DataTable's column visibility to turn off and on as needed.
We would need to see your page and your code to get a better idea of what you are trying to accomplish and how you are going about it.
Hi @Bindrid2,
Thanks for your answer, i think i will go on it, because i don't see any other solution.
Thanks all for your help.