how to render an array in a column
how to render an array in a column
eharding
Posts: 15Questions: 7Answers: 0
I have a checkbox field
{
label: "Contact Name: *",
name: "apd_history.agency_contact",
type: "checkbox",
},
{ data: "apd_history.agency_contact", render: "[, ]agency_contact" },
the field works,and the data (i.e. multiple values separate by commas are inserted into the db) but I can't figure out how to get the contents of that column to render on the table. I don't need/want to edit it. I just want to display the cont
This discussion has been closed.
Replies
The
columns.data
andcolumns.render
properties work together. Basically whatever thedata
property points to therender
will see as the data for the column. So I think in the above you probably want to use:Or perhaps:
Using
data: null
will let the renderer see the whole original object.Allan
thanks, but neither seemed to help, started getting http://datatables.net/tn/4.
The json contains the id in the column, but they are generating the names "agency_contact":"2591,1311"
Oh I see - thanks. You don't have an array in the
apd_history
property. Its an object.So you would use
apd_history.agency_contact
.The
[]
syntax is used to get data from an array.Allan
thanks, that and adding separator "," did it!