how to render an array in a column
how to render an array in a column
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.dataandcolumns.renderproperties work together. Basically whatever thedataproperty points to therenderwill see as the data for the column. So I think in the above you probably want to use:Or perhaps:
Using
data: nullwill 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_historyproperty. 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!