Sorting, Filtern with Editor Mjoin
Sorting, Filtern with Editor Mjoin
btree
Posts: 99Questions: 14Answers: 11
Hi guys,
I use a Mjoin in my datatable and don't know how I get filtering and sorting working with column 'uc_permission'.
PHP Code:
->join(
Mjoin::inst( 'uc_permissions' )
->link( 'uc_users.id', 'uc_user_permission_matches.user_id' )
->link( 'uc_permissions.id', 'uc_user_permission_matches.permission_id' )
->fields(
Field::inst( 'id' )
->validator( 'Validate::notEmpty' )
->validator( 'Validate::boolean' )
->options( 'uc_permissions', 'id', 'name' ),
Field::inst( 'name' )
)
)
JS Code:
{
data: 'uc_permissions',
render: function ( data, type, row ) {
var array = [];
$.each(data, function(key, value){
array.push(value.name);
});
return array;
}
},
Thanks for any help!
Cheers
Hannes
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Unfortunately there is no option to have sorting occur across rows on
Mjoin
ed data when server-side processing is enable at this time.Sorting across arrays is not something that I'm really sure how to tackle in an efficient way, particularly since the data is obtained from the database with two different queries.
On the client-side its a different story since you can just use the string representation of the data - that should happen automatically, but not with server-side processing at the moment I'm afraid.
Allan
Ok thanks, no problem. Then I just disable filtering and sorting for this column.
Thanks again for the quick answer!
Cheers
Hannes