Renderer question.
Renderer question.
boicenet
Posts: 47Questions: 12Answers: 1
I have the following code that works great; however, it displays more records than I'd like (all records from the database table). I'd rather limit the returned data to columns equal to a specific value. Similar to a where clause (where x.id = "1"). Is this possible to accomplish with a renderer?
columnDefs: [
{
// The `data` parameter refers to the data for the cell (defined by the
// `data` option, which defaults to the column being worked with, in
// this case `data: 0`.
"render": function ( data, type, row ) {
return ''+ row.users.full_name +'';
},
"targets": 14
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Not with a renderer (which just renders existing data and doesn't filter at all). But if you are using the Editor PHP libraries, you can apply a WHERE condition which will do what you want. Documentation for that is available here.
Allan
Thanks, Allan.
I read the documentation you referenced, but cannot figure out where exactly to place the WHERE condition code. I want to filter the data displayed in a dropdown list on the editor form.
Oh - sorry. I misunderstood. That's in a different section of the documentation in that case. The forth parameter passed into the
options()
method can be used as a WHERE condition for the options shown in the list.Allan
Excellent! Thank you, Allan. Your advice works great as usual!