columns.render with condition
columns.render with condition
louis_Elesse
Posts: 3Questions: 3Answers: 0
"services": [{
"id": "1",
"nom": "Garde-Malade"
}, {
"id": "2",
"nom": "Soins infirmiers",
"actif": true
}, {
"id": "3",
"nom": "P\u00e9dicure M\u00e9dicale"
}, {
"id": "4",
"nom": "je ne sais plus"
}],
i have this in my colums initialisation table
{
"data": "services",
"render": "[, ].nom"
},
when i execuse my application it create a comma separated list like this:
Garde-Malade, Soins infirmiers, Pédicure Médicale, je ne sais plus
how can iapply condition on "render": "[, ].nom" to obtain only the one with "actif": true?. i mean to obtain only Soins infirmiers
thank for your help!
This discussion has been closed.
Answers
Hi @louis_Elesse ,
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
You can use render with a function as in my column filtr.field_type. Your comma separated list should get passed in as parameter "data". Then you can do whatever you like with it using Javascript or jQuery.
Please see this too: https://datatables.net/reference/option/columns.render
There's also one example with render as a function.
I would just use a debugger to see what gets passed in as parameter "data" when using the function.