It is possible to have two value in single column datatable?
It is possible to have two value in single column datatable?
mastersuse
Posts: 61Questions: 28Answers: 0
It is possible to have two value in single column datatable? I want both data: "login"
and data: "user_id"
as below be in one column which will carry two values which is login
and user_id
.
If it is possible, how to implement that way? please help and guide me.
{ data : "login",
render: function(data){
return "<span title='Reset Password' onclick='reset_password(""+data+"")'></span>";
}
},
{ data : "user_id",
render: function(data){
return "<span title='Edit' onclick='edit_user(""+data+"")'></span>"+
"<span title='Delete' onclick='delete_user(""+data+"")'></span>";
}
}
This question has accepted answers - jump to:
This discussion has been closed.
Answers
{
data: null,
render: function ( data, type, row ) {
return data.table.login+' '+data.table.user_id;
}
https://editor.datatables.net/examples/bubble-editing/grouped.html
I am doing like this.
But this error appear at console.
data.table.login,
"table" is the name of your table in the database
yes already doing as suggested above but still appear same error.
https://stackoverflow.com/questions/34287402/datatables-cannot-read-property-length-of-undefined
Take a look at the
columns.render
docs for the description of the function parameters.data
is the data for the column androw
is full dataset for the row. You will want to use therow
parameter and access the data like this:row.login
androw.user_id
. Therow
data will look like the data structure you defined usingcolumns.data
. Thetable
name should not be used as part of accessing the data.Something like this:
Kevin
Thank you both of you guys, I combined both solutions and solve my problem.