When I first encountered this problem, there was no solution. Not even in the documentation of sample list of JEasyUI‘s portal.

However, I after I posted a topic in their forum to include it in a future release or so, probably after a day or two, they immediately created a Javascript library to do just that.

Impressive!

Look for the file datagrid-groupview.js and make sure you include that or else grouping rows won’t work in the data grid.

Retrieve your JSON data as is and simply assign the field that you want as basis for grouping the rows and changing the view’s value to groupview.

That’s it! Easy as pie!

Say, your sql result will return multiple rows that may look something like this

id email
1 email1@email.com
1 email2@email.com

There is a pretty useful MySQL function that displays the email addresses found in the 2 rows as one. Using the GROUP_CONCAT(), e.g. GROUP_CONCAT(column_name separator_character) maybe result in something like this

id email
1 email1@email.com email2@email.com

The syntax used was SELECT id, GROUP_CONCAT(email, ‘ ‘)

You can use any other character like comma.

Related Posts Plugin for WordPress, Blogger...