How to have extra column than data?
How to have extra column than data?
anjibman
Posts: 115Questions: 10Answers: 0
If I have 8 columns in the table but server only return 6 columns value how I can tell DataTable to fill other two columns with some value? I tried this but getting Requested unknown parameter error.
"processing": true,
"serverSide": true,
"ajax": "/networkattorneys/cases/openCases.htm",
"columns": [
{ "data": "id" },
{ "data": "firstName" },
{ "data": "lastName" },
{ "data": "groupName" },
{ "data": "requestDate" },
{ "data": "status" },
null,
null
]
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Perhaps this example will help?
I tried this
but it never get after function(..). From line 5 its jumps to 11.
I'm a bit confused, why say that column 0 is
{ "data": null }
and then later say"data": "memberId"
? Couldn't you just make it{ "data": "memberId"}
in the"columns":
definition?I wan to use display memberID value as hyerlink.
Try this:
I don't think we can comment out line 13. Even with that its not displaying link instead it displayed [object Object]. I tried with data.memberId in line 8 too same result [object Object]
Got the solution:
all can be done with render in columns
Well I'm glad you found a solution :) Though I admit I'm a bit confused about where
memberId
comes from? Where does that property come from?Its in JSON response (data) too along with other. That's why I am able to do data.memberId.
Nevermind. It seems that, when a table's column is defined with
data: null
, then thedata
parameter of therender()
function is equivalent to therow
parameter. I did not realize this!I'd also like to point out that this should work as well:
If I'm understanding the DT API correctly.