Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:grouping [2012/06/14 13:10]
tony
wiki:grouping [2017/12/09 14:51] (current)
admin
Line 1: Line 1:
 ====== Common rules ====== ====== Common rules ======
  
-Grouping is a way to group data by diffrent criteria. jqGrid ​support ​currently one level grouping.+Grouping is a way to group data by diffrent criteria. jqGrid currently ​supports ​one level of grouping.
  
-The simple way to group in jqGrid is to enable grouping with the grid option **grouping:​true** and define a field name on which grouping ​occur. The name should ​correspondent of the name in colModel¬†+The simple way to group in jqGrid is to enable grouping with the grid option **grouping:​true** and define a field name on which grouping ​occurs. The name should ​correspond to  ​the name in colModel.¬†
-The definituion ​is done with array //​groupField//​ which is a part of another grid option **groupingView**. ​+The definition ​is done with array //​groupField//​ which is a part of another grid option **groupingView**. ​
  
-It is important to note that if you want grouping to be correct, then the data should come from server to grid sorted by that field. When we are in local mode (the data is array) the data is grouped (sorted) automatically so there is no need to define additional sort column.+It is important to note that if you want the grouping to be correct, then the data should come from server to the grid sorted by that field. When we are in local mode (the data is an array) the data is grouped (sorted) automatically so there is no need to define ​any additional sort column.
  
 In order to inform the server that we want to have a grouped data, jqGrid add to the sidx parameter the  groupField name on which we group. This done only if we have enabled the grouping and the data is remote. ​ In order to inform the server that we want to have a grouped data, jqGrid add to the sidx parameter the  groupField name on which we group. This done only if we have enabled the grouping and the data is remote. ​
Line 24: Line 24:
 </​code>​ </​code>​
  
-then the request ​send to the server will look like this (using FireBug)+then the request ​sent to the server will look like this (using FireBug)
  
 {{:​wiki:​grouping.png|}} {{:​wiki:​grouping.png|}}
Line 67: Line 67:
  
 ^Property^Type^Description^Default^ ^Property^Type^Description^Default^
-|groupField|array|Defines the name from [[colmodel_options | colModel]] on which we group. The first value is the first lavel, the second values is the second level and etc. Currently only one level is supported ​|empty|+|groupField|array|Defines the name from [[colmodel_options | colModel]] on which we group. The first value is the first lavel, the second values is the second level and etc. |empty|
 |groupOrder|array|Defines the initial sort order of the group level. Can be asc for ascending or desc for descending order. If the grouping is enabled the default value is asc.|empty| |groupOrder|array|Defines the initial sort order of the group level. Can be asc for ascending or desc for descending order. If the grouping is enabled the default value is asc.|empty|
 |groupText|array|Defines the grouping header text for the group level that will be displayed in the grid. By default if defined the value if {0} which means that the group value name will be displayed. ​ It is possible to specify another value {1} which meant the the total cont of this group will be displayed too. It is possible to set here any valid html content.|empty| |groupText|array|Defines the grouping header text for the group level that will be displayed in the grid. By default if defined the value if {0} which means that the group value name will be displayed. ​ It is possible to specify another value {1} which meant the the total cont of this group will be displayed too. It is possible to set here any valid html content.|empty|
 |groupColumnShow|array|Show/​Hide the column on which we group. The value here should be a boolean true/false for the group level. If the grouping is enabled we set this value to true. |empty| |groupColumnShow|array|Show/​Hide the column on which we group. The value here should be a boolean true/false for the group level. If the grouping is enabled we set this value to true. |empty|
 |groupSummary|array|Enable or disable the summary (footer) row of the current group level. If grouping is set the default value for the group is false.|empty| |groupSummary|array|Enable or disable the summary (footer) row of the current group level. If grouping is set the default value for the group is false.|empty|
 +|groupSummaryPos|array| Set the position of the summary row at current group level. Possible values - header or footer. If set to header the summary values are placed at the same row where the group values is. If footer is set additional row at end of the group level is builded and the summary values are placed here|footer|
 +|hideFirstGroupCol|boolean| If set to true the values at first column are replaced with empty ones so that we have a pretty view. This usually is set ih the first column is a group column|false|
 |showSummaryOnHide|boolean|Show or hide the summary (footer) row when we collapse the group.|false| |showSummaryOnHide|boolean|Show or hide the summary (footer) row when we collapse the group.|false|
 |groupCollapse|boolean|Defines if the initially the grid should show or hide the detailed rows of the group.|false| |groupCollapse|boolean|Defines if the initially the grid should show or hide the detailed rows of the group.|false|
 |plusicon|string|Set the icon from jQuery UI  Theme Roller that will be used if the grouped row is collapsed|ui-icon-circlesmall-plus| |plusicon|string|Set the icon from jQuery UI  Theme Roller that will be used if the grouped row is collapsed|ui-icon-circlesmall-plus|
 |minusicon|string|Set the icon from jQuery UI Theme Roller that will be used if the grouped row is expanded|ui-icon-circlesmall-minus| |minusicon|string|Set the icon from jQuery UI Theme Roller that will be used if the grouped row is expanded|ui-icon-circlesmall-minus|
 +|isInTheSameGroup| array| The elements of the array correspond to the number of the groups. Every element of this array is a function which should return true or false. In case if it return false the element will be added in the groupt. Parameters passed to this functiona are : previous value, current value, group index, group object| null | 
 +|formatDisplayField| array| The elements of the array correspond to the number of the groups.Every element should return a value which will be display grouped value. Parameters passed to this function are: current value, source value, colModel option, group index and group object.|null| ​
  
 ===== colModel Options ===== ===== colModel Options =====
 Additionally if the group summary footer row is enabled we use a option in column model to set the type of the summary field. Additionally if the group summary footer row is enabled we use a option in column model to set the type of the summary field.
-We add two options in colModel and it name is **summaryType** ​and **summaryTpl**. ​+We add two options in colModel and it name is **summaryType****summaryTpl**, **summaryRound** and **summaryRoundType**. 
  
 === summaryType === === summaryType ===
Line 129: Line 133:
 ===summaryTpl=== ===summaryTpl===
 This option acts as template which can be used in the summary footer row. By default its value is defined as {0} - which means that this will print the summary value. The parameter can contain any valid HTML code. This option acts as template which can be used in the summary footer row. By default its value is defined as {0} - which means that this will print the summary value. The parameter can contain any valid HTML code.
 +
 +===summaryRound===
 +<code javascript>​
 +
 +{..., summaryRound:​ number_of_digits,​ ... }
 +</​code>​
 +
 +By default this parameter is not defined in colModel when grouping is on.\\
 +The number_of_digits by default is not defined.\\
 +This options determines the length of the remaining part after the decimal point.
 +
 +===summaryRoundType===
 +<code javascript>​
 +{ summaryRoundType:​ '​round'​ | '​fixed'​ }
 +</​code>​
 +
 +This parameter works only if the //​summaryRound//​ is defined.
 +
 +This is rounding method selector.
 +
 +Parameter //round// means 'just round it and do not keep trailing zeroes'​. //fixed// means 'round it and keep the given fixed number of digits even zeroes'​.
 +
 +The default option is set to round
  
 ===== Methods ===== ===== Methods =====

QR Code
QR Code wiki:grouping (generated for current page)