datatables and many to many relations

datatables and many to many relations

mlmariusmlmarius Posts: 6Questions: 0Answers: 0
edited June 2013 in General
Hi. My server returns the following json response:

{
"sEcho":1,
"iTotalRecords":1,
"iTotalDisplayRecords":1,
"aaData":[
{
"id":"1",
"first_name":"asdasdasd",
"last_name":"asdfasdfasdf",
"email_address":"sdfasdfasdf@asdfasdf",
"username":"sdfasdf",
"Profile":{
"id":"1",
"phone":"0722734132",
"pic":"asdasdasd.jpg",
"user_id":"1"
},
"Permissions":[
{"id":"1","name":"profi","description":"This person has role of profi","created_at":"2013-06-17 22:21:46","updated_at":"2013-06-17 22:21:46"},
{"id":"2","name":"partner","description":"This person has role of partner","created_at":"2013-06-17 22:21:46","updated_at":"2013-06-17 22:21:46"}
]
}
]
}


as you can see Profile is a 1 to 1 relatin so if i configure a datatable column with mdata: Profile.phone it will just show it correctly. Also the searching and indexing works corectly for this relation.

The problem is for the permissions. As you see this is a collection of stuff because there is a many to many relation between my user table and the permissions table.

Question is ... how can i configure the Permissions column so that is just shows all the permissions by name for example ? Also how can i make it so that search works properly ? I can't just configure the mdata Permissions.name :(

Replies

  • koosvdkolkkoosvdkolk Posts: 169Questions: 0Answers: 0
    Why don't you let your server return only the name for the Permissions column?
This discussion has been closed.