ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: youngvan on June 17, 2014, 06:48:23 pm

Title: Row grouping by few fields
Post by: youngvan on June 17, 2014, 06:48:23 pm
Hey,

Is it possible to make a group by few fields simultaneously?
For example I wanna make group by Country and City.
CountryCityDistrict
EnglandLondonGreenwich
EnglandLondonCroydon
EnglandLondonBromley

I've tried to add group index:
Code: [Select]
groupModel : ['2fieldGroup'] and add
Code: [Select]
dataIndx : "2fieldGroup" at first column of header.
After this for each row with data I add
Code: [Select]
$row['2fieldGroup'] = "England_London";It works but in this case Country column shows "England_London" instead of just "England"
Any suggestions?
Title: Re: Row grouping by few fields
Post by: paramvir on June 17, 2014, 07:24:53 pm
I'm not sure whether I got your question completely but grouping by multiple fields is simple.

Code: [Select]
groupModel:{
            dataIndx: ["Country","City"]
        },           

Example:
http://paramquery.com/pro/demos/group_rows
Title: Re: Row grouping by few fields
Post by: youngvan on June 17, 2014, 08:49:41 pm
I saw this option, it's not what I really need.
I'd like to have a possibility to group by just one field but value of this field should consist of two other (Country + City)
Maybe it's possible to set two different values for cell: one for grouping("England_London") and second parameter which should be displayed in table("England"), so "group by" value of cell will be different from "displayed" value in table.
Title: Re: Row grouping by few fields
Post by: paramvir on June 17, 2014, 09:42:27 pm
view can be different from the data in a cell

use column.render callback

render: function(ui){
  return ui.rowData["Country"]+"-"+ui.rowData["City"];
}

API ref:
http://paramquery.com/pro/api#option-column-render