animModelType: objectDefault: { on: undefined, duration: 290 }
It configures the animation of cell transitions during sorting, filtering, row expansion, column resize, reorder, etc in the grid.
on It enables / disables the animations.
duration: It controls the duration of the animations in milliseconds.
Code examples:
Initialize the grid with animModel option specified.
//turn animations on and set a new duration.
pq.grid( selector, {
animModel: { on: true, duration: 400 }
});
A blank column is automatically appended when right key is pressed on the rightmost visible column of grid.
Code examples:
Initialize the grid with autoAddCol option specified.
pq.grid( selector, { autoAddCol: true });
A blank row is automatically appended when down key is pressed on the last visible row of grid.
Code examples:
Initialize the grid with autoAddRow option specified.
pq.grid( selector, { autoAddRow: true });
This option works together with fillHandle option.
When this option is true, grid figures out the pattern or series for numbers and date data types when
fill handle is dragged across the cells.
Code examples:
Initialize the grid with autofill option specified.
//turn autofill off.
pq.grid( selector, { autofill: false } );
Grid calculates and assigns height to every row in body, header ( can be overridden by autoRowHead ), and footer ( can be overridden by autoRowSum ) based on its content when this option is true.
Auto height of rows is computed asynchronously just a little while after refresh event.
autoRowHeight event is fired when auto height is complete.
Note that autoRow doesn't apply to group title and summary rows currently.
Code examples:
Initialize the grid with autoRow option specified.
pq.grid( selector,{autoRow: true});
autoRowHeadType: BooleanDefault: true
Grid calculates and assigns height to every row in header based on its content when this option is true.
Code examples:
Initialize the grid with autoRowHead option specified.
pq.grid( selector,{autoRowHead: true});
autoRowSumType: BooleanDefault: true
Grid calculates and assigns height to every row in footer based on its content when this option is true.
Code examples:
Initialize the grid with autoRowSum option specified.
pq.grid( selector,{autoRowSum: true});
By default the events generated by the grid doesn't bubble up the DOM.
It can be turned on by setting this option to true.
Code examples:
Initialize the grid with bubble option specified.
//turn bubbling on
pq.grid( selector, { bubble: true } );
Get or set the bubble option, after initialization:
//getter
var bubble = grid.option( "bubble" );
collapsibleType: ObjectDefault: {css: {zIndex: 1000}, on: true, toggle: true}
collapsed
- Type: boolean
- Description: Set or get the initial collapsed or expanded state of the grid. In collapsed state, only the top few pixels (title bar) of the grid are visible.
css
- Type: object
- Default:
{ zIndex: 1000 }
- Description: An object of CSS rules applied to the grid in full-screen/document state.
cssCollapse
- Type: object
- Default:
{ height: "2.3em", width: '15em' }
- Description:(v11.1.0) An object of CSS rules applied to the grid in collapsed state.
on
- Type: boolean
- Default: true
- Description: Set or get the visibility of the collapsible icon ⏵ in the title bar.
toggle
- Type: boolean
- Default: true
- Description: Set or get the visibility of the full-screen icon ⛶ in the title bar.
toggled
- Type: boolean
- Description: Get or set the initial full-screen state of the grid.
When true, the grid occupies the full document height and width.
When false or undefined, the grid is displayed normally.
After initialization, use grid.toggle() to switch between full-screen and normal states.
Code examples:
Initialize the grid with collapsible option specified.
//create grid in full screen state initially.
pq.grid( selector, { collapsible: { toggled: true } } );
Defines the columns in the grid. It is an array of objects, where each object represents a column.
Notes:
- For local data, the grid can autogenerate colModel from the first row if colModel is not provided.
- If columns are added, removed, or re-arranged, call
refreshCM to update the grid.
- If properties of a column are updated,
refreshCM is not required.
Code examples:
Initialize the grid with colModel option specified.
var colM = [
{ title: "ShipCountry", width: 100 },
{ title: "Customer Name", width: 100 }
];
pq.grid( selector, {colModel:colM} );
Get or set the colModel option, after initialization:
//getter
var colModel = grid.option( "colModel" );
//setter for replacing whole colModel.
grid.option( "colModel", colModel );
//Refresh the colModel after updating visual properties (e.g., hidden) of grouped columns.
grid.refreshCM();
Defines the horizontal alignment of text in a column.
Possible values: left, right, center
- If the value is undefined and the column
dataType is numeric ('float' or 'integer'), the grid automatically sets align = 'right'.
- (v7.0.0+) Individual cells can override this using
rowData.pq_cellprop[dataIndx].align.
Code examples:
Initialize the grid with column.align option specified.
var colM = [
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer", align: "right" }
];
pq.grid( selector,{colModel: colM });
(v7.0.0) Defines html attributes for the column header cell, used for setting
title.
Code examples:
Initialize the grid with column.attrHead option specified.
var colM =
[
{ title: "Company", width: 100 },
{ title: "Rank", width: 100, attrHead: {title: 'header title'} }
];
pq.grid( selector, { colModel: colM } );
column.cbType: ObjectDefault: { all: false, header: false, select: false, check: true, uncheck: false }
It configures properties of a checkbox column.
Checkbox columns can be created in 2 different ways
Checkbox columns can be programmatically manipulated using Checkbox method.
The following events fire in this order when checkboxes are checked/unchecked:
beforeCheck → beforeValidate → change → rowSelect → check
Note: rowSelect fires only when checkboxes are bound to row selections.
(v9.1.0)
By default, beforeValidate and change events are not fired, and history is not saved when:
- there is a header checkbox, or
- checkboxes are bound to row selections.
This behavior can be changed using cb.history and cb.useTxn options.
Checkbox Column Options
all
- Type: boolean
- Default: false
- Description:
When true, the header checkbox affects all rows on all pages;
when false, it affects only the current page.
check, uncheck
- Type: boolean, number, string
- Default: true, false
- Description:
Cell value becomes true or false depending on checkbox state.
Can be mapped to custom values, e.g.:
check: "YES"
uncheck: "NO"
header
- Type: boolean
- Default: false
- Description:
Shows a checkbox in the column header.
You may override the default header checkbox using column.title to add a custom label.
history
- Type: boolean
- Description:
(v9.1.0) Explicitly enable storing checkbox history for undo/redo.
Works only when change events are enabled.
maxCheck
- Type: integer
- Description:
Maximum number of allowed checked checkboxes.
Should not be used with header checkbox.
select
- Type: boolean
- Default: false
- Description:
When true, row selection becomes bound to checkbox state.
useTxn
- Type: boolean
- Description:
Enable transactions and fire beforeValidate and change events.
Code examples:
Initialize the grid with column.cb option specified.
//define colModel ( one way ).
var colM = [
//checkboxes are displayed and their values saved in same column.
{
type: 'checkbox',
dataIndx: 'continued',
dataType: 'bool',
cb: {all: true, header: false}
},
...
];
//define colModel: alternative way
var colM = [
//checkboxes are displayed beside cell values in this column.
{
type: 'checkbox',
dataIndx: 'ShipCountry',
cbId: 'cb' //dataIndx of another column.
},
//checkbox values are stored in this column (usually hidden).
{
dataIndx: 'cb',
dataType: 'bool',
hidden: true,
cb: {select: true, header: true}
},
...
];
pq.grid( selector, {colModel: colM})
dataIndx of another column where checkbox values are stored
It's used along with type: 'checkbox'.
Class to be assigned to whole column including header.
(v8.7.0) Class is assigned to header filter cell.
Class is assigned to header cell.
This class is also assigned to header filter cell of same column previous to v8.7.0
column.collapsibleType: Object
📐 Collapsible Grouped Columns
A grouped parent column can be made collapsible by defining the collapsible property for it. When collapsible, an icon is displayed next to the column's title, allowing users to toggle between the collapsed and expanded states.
The collapsible property is an object that controls the initial state and visible child columns when collapsed:
Code examples:
Initialize the grid with column.collapsible option specified.
var colM = [
{ title: "Company", collapsible: { on: true, last: true }, colModel: [
{ title: "Company A" } , { title: "Company B" }
]},
{ title: "Rank", width: 100, dataIndx: 0 }
];
pq.grid( selector,{ colModel: colM });
Get or set the column.collapsible option, after initialization:
//set collapsible of 2nd grouped column in colModel.
colM[1].collapsible = {on: true};
//refesh colModel.
grid.option( "colModel", colM );
column.colModelType: Array
Nesting of colModel in a column results in grouping of columns. column acts as parent of the columns contained in the colModel. It can be nested any number of levels.
Code examples:
Initialize the grid with column.colModel option specified.
var colM = [
{ title: "Company", width: 100 ,colModel: [
{ title: "Company A" } , { title: "Company B" }
]},
{ title: "Rank", width: 100, dataIndx:0 }
];
pq.grid( selector,{ colModel: colM });
Get or set the column.colModel option, after initialization:
//getter
var colM = grid.option( "colModel" );
//get nested colModel of 1st column if any.
var colModel = colM[0].colModel;
//setter: set nested colModel of 2nd column in colModel.
colM[1].colModel = [{title:"Title A", width:'120'} , {title:"title B"} ];
//refesh colModel.
grid.option( "colModel", colM );
When set to false, this option prevents a column from being copied to the clipboard.
(v9.0.0) Please use column.skipExport option to prevent column from being exported.
Zero based index in array or key name in JSON of the column.
This is used to bind grid column with data in array or JSON. In case of array data, it defaults to index of column in colModel if no dataIndx is provided during initialization of grid.
dataIndx is mandatory in case of JSON.
Code examples:
Initialize the grid with column.dataIndx option specified.
//array
var colM = [
{ title: "Company", width: 100 ,dataIndx : 1},
{ title: "Rank", width: 100,dataIndx : 0 }];
//JSON
var colM = [
{ title: "Company", width: 100 ,dataIndx: "company" },
{ title: "Rank", width: 100, dataIndx: "rank" }];
pq.grid( selector,{ colModel: colM });
column.dataTypeType: StringDefault: "string"
This option tells grid how to treat column's data while copy/paste, editing, local sorting, local filtering and validations. Possible values are bool, date, float, integer, string or stringi.
bool is used for boolean values. It can be true, false, null or undefined.
date is used for date or datetime fields. It should be valid javascript recognizable date in either of these formats:
mm/dd/yy e.g., 07/04/1776
- ISO 8601 format
yy-mm-ddThh:mm:ss e.g., 1776-07-04T08:20:01 or 1776-07-04
float is used for numbers with decimal places like currency, etc.
html is used for html text.
integer is used for integers.
string is the used for text. It escapes html entities in text so as to make it safe for rendering.
stringi is similar to string in all aspects except that it's used for case insensitive sorting.
Code examples:
Initialize the grid with column.dataType option specified.
var colM = [
{ title: "Company", width: 100 , dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer" }
];
pq.grid( selector,{ colModel: colM });
A callback function to reverse a formatted value.
It's the counterpart of column.format callback and is required by the grid in filtering UI.
When true, it prevents addition of column via drag n drop in toolPanel -> aggregates panel.
When true, it prevents addition of column via drag n drop in toolPanel -> row grouping panel and in grouping header toolbar.
This option replaces column.groupable option.
When true, it prevents addition of column via drag n drop in toolPanel -> column pivot panel.
Set it to false to disable editing for the whole column or implement a callback function to return true or false selectively for different rows.
The callback function receives ui:{ rowIndx, rowData, colIndx, dataIndx, column } as argument.
This option value or callback return value of true / false takes precedence over global editable option while deciding final editability of a cell in grid.
Code examples:
Initialize the grid with column.editable option specified.
var colM = [
//disable editing for Company column selectively.
{ title: "Company", width: 100, dataType: "string", editable: function(ui){
var rowIndx = ui.rowIndx;
return (rowIndx%2 === 0);
`,
//disable editing for Rank column.
{ title: "Rank", width: 100, dataType: "integer", editable: false }];
pq.grid( selector,{ colModel: colM });
It's an object defining the editing behaviour for a column and it overrides the global editModel properties.
Code examples:
Initialize the grid with column.editModel option specified.
var colM = [
{ title: "ShipCountry", editModel:
{ saveKey: '', keyUpDown: false}
},
{ title: "Customer Name", width: 100 }];
//editModel is provided for 1st column.
pq.grid( selector, { colModel: colM } );
Column Editor Properties
Defines inbuilt or custom editor properties for a grid column.
Overrides global editor properties. Can be an object or a callback returning these properties.
General Behavior
- Editor not displayed if set to
false or callback returns false.
- Useful for special column types (e.g.,
checkbox) where cell renderer acts as editor.
- Can be a callback returning editor properties.
type
- Values:
textbox, textarea, contenteditable, select, checkbox, callback, string, or null.
- Callback variant receives cell coordinates and returns control name (e.g.,
textbox, select).
- Enables different editors for different rows in the same column.
init
- Type:
callback (evt, ui) => void
- Converts/initializes simple HTML controls (
textbox, select) into custom editors (e.g., jQueryUI datepicker, autocomplete).
- Receives
ui argument with cell context.
- Since v8.4.0, only
init can be used to create custom editors.
prepend
- Object of value-label pairs prepended to select list options.
- Example:
{ '' : 'Select an option' } or { 0 : 'a', 1 : 'b' }.
- Multiple pairs may appear in random order at the top.
options
- Array of options for
select type editor.
- Formats:
- Array of strings:
[ "value1", "value2" ]
- Array of associative pairs:
[ { "CB01": "Mark" }, { "CB02": "Robert" } ]
- JSON objects:
[ { customerid: "CB01", contactName: "Mark" }, ... ]
- Requires
labelIndx and valueIndx.
- Supports disabled (
pq_disabled: true) and preselected (pq_selected: true) options.
- Can also be a callback returning options.
labelIndx / valueIndx
- Used with JSON options to bind label/value fields to grid rowData.
- Example:
valueIndx = "customerid", labelIndx = "contactName".
groupIndx
- Enables grouping via
<optgroup> in select lists.
- Example:
groupIndx = "country" with valueIndx = labelIndx = "region".
dataMap
- Array of extra field names to bind from JSON options to select list and rowData.
- Example:
[ "QuantityPerUnit", "UnitPrice", "UnitsInStock", "Discontinued" ].
mapIndices
- Maps JSON field names to grid’s
dataIndx when they differ.
- Example:
{ customerid: "customerID", contactName: "contactname" }.
getData
- Optional callback returning custom data/value from editor.
- Receives
ui argument.
- Returned value saved in
rowData[dataIndx].
- Example:
ui.$cell.find("select").val() or selected text.
cls
- Injects CSS classes into editor control.
- Example:
cls: "green yellow".
- Callback variant supported for row-specific classes.
style
- Adds inline CSS styles.
- Example:
style: "font-style:italic;".
- Callback variant supported.
attr
- Adds HTML attributes to editor control.
- Examples:
attr: "multiple" for multi-select.
attr: "maxlength=5" for input length restriction.
- Callback variant supported.
Change Log
- Since v3.2.0,
column.editor can also be a callback.
UI Arguments (for callbacks)
These are the ui arguments passed to editor-related callbacks (init, getData, etc.):
$cell
- Type:
jQuery
- jQuery wrapper on container div in which to append the custom editor.
rowData
- Type:
Array | PlainObject
- Reference to row data (1D array or object).
rowIndx
- Type:
Integer
- Zero-based index of the row.
dataIndx
- Type:
Integer | String
- Zero-based index in array or key name in JSON.
colIndx
- Type:
Integer
- Zero-based index of the column.
Code examples:
Initialize the grid with column.editor option specified.
let colM = [
{ title: "ShipCountry", editor: {
type: 'textarea',
attr: 'rows=5'
}},
{ title: "Customer Name", width: 100 }
];
pq.grid( selector,{ colModel: colM });
Rendered cell values ( otherwise raw cell data ) in this column are included in the exported data when this option is true.
This option overrides render parameter of exportData() method for the current column.
It describes the filter behavior of the column using an object having following sub-options:
attr (string)
Adds HTML attributes to the control.
conditionList (Array)
Show only the specified filter conditions in the dropdown.
Example:
conditionList: ['begin', 'end', 'range']
If not set, all built-in and custom conditions valid for the column’s data type are shown.
conditionExclude (Array)
Hide the specified filter conditions from the dropdown.
Example:
conditionExclude: ['between', 'regexp']
conditions (Object)
Used to override inbuilt or custom condition properties for current column filter.
//override range compare function.
conditions: {
range:{
//override compare property of range condition.
compare: (cellData, value, value2) => boolean
}
}
cls (string)
Inject CSS class(es) to the control.
crules (Array)
Used to define multiple filters to a single column.
crules: [
{ condition: 'contain', value: 'a' },
{ condition: 'end', value: 'b' },
...
]
Sub-options of crules:
condition (string)
Filter condition: contain, notcontain, begin, end, equal, notequal,
empty, notempty, less, great, between, range, regexp,
notbegin, notend, lte, gte.
value (any)
Value to match against.
Array for range, regex for regexp, ignored for empty/notempty.
value2 (any)
Applicable only for between condition.
diExtra (Array)
Extra columns whose data is loaded into filter dropdowns.
diExtra: [ 'code' ]
dpOptions (Object)
Options for jQuery UI datepicker.
dpOptions: {
...
}
dpOptions2 (Object)
Same as dpOptions, but for 2nd input (e.g., between filter).
format (string | function)
Overrides column.format used by jQuery UI datepicker & filter dropdown.
gridOptions (Object)
Adds properties to dropdown grid.
gridOptions: {
numberCell: {show: false}
}
groupIndx (string)
Field name for grouping range condition options.
Example data:
[
{ country: 'Japan', region: 'Hokkaidō' },
{ country: 'Japan', region: 'Chūbu' },
{ country: 'UK', region: 'London' },
{ country: 'UK', region: 'Yorkshire' },
...
]
valueIndx = labelIndx = "region", groupIndx = "country"
init (Function)
Callback to custom-initialize filter control. Return true to skip grid initialization.
Arguments (ui):
- dataIndx
- column
- indx
- $cell
- $editor
listener (object | function | string)
Event binding for triggering filtering.
Examples:
{ 'keyup': function(evt, ui){} }
'change'
function(evt, ui){}
Supports native & custom events, including timeout.
ui contains:
- dataIndx
- column
- value
- value2
maxCheck (integer)
Max allowed checked checkboxes.
menuIcon (boolean)
Controls display of filter menu icon.
mode (string)
Defines boolean mode between multiple conditions. Default: AND.
options (Array | function)
Options for range filter. Supports:
['Argentina', 'Austria', ...]
[ { a: 'Apple' }, { b: 'Bat' }, ... ]
[ { ShipCountry: 'Argentina' }, ... ]
Can be a function returning any of above.
If defined, grid uses this instead of auto-generating list.
selectGridCreated (Function)
Callback when dropdown grid is initialized.
Arguments: ui: {grid, column}
selectGridObj (Function)
Callback before dropdown grid is created.
Arguments: ui: {obj, column}
style (string)
Inline CSS for control.
title (function)
Returns title for filter cell dropdowns.
Signature: (values, column) => string
Custom filter condition can be defined by extending pq.filter.conditions.
Code examples:
Initialize the grid with column.filter option specified.
var colM =
[
{
dataIndx: "ShipCountry",
filter: {
crules: [{ condition: 'equal', value: 'france' }]
}
},
{
title: "Ship Region",
groupIndx: "ShipCountry",
filter: {
crules: [{ value: ['AR', 'CA', 'WA'], condition: 'range' }]
}
}
];
pq.grid( selector, {colModel: colM} );
Get or set the column.filter option, after initialization:
//getter
var colM = grid.option( "colModel" );
//get filter of 1st column
var filter = colM[0].filter;
//setter
//set filter of 2nd column
colM[1].filter =
{
crules: [{ condition: "range", value: [ "IN", "US" ] }]
};
Custom filter condition can be defined by extending pq.filter.conditions as below:
//name of the new condition is notbetween.
pq.filter.conditions.notbetween = {
filter: {
//html attributes to apply to control.
attr: "",
//class apply to control.
cls: "",
//css style to apply to control.
style: "",
//type of UI, textbox (one text box), textbox2 ( for 2 text boxes ), checkbox or select (for dropdown).
type: 'textbox2',
//custom callback to initialize control or use inbuilt initialization function (pq.filter.datepicker).
init: pq.filter.datepicker
},
/*optional callback to return filter properties dynamically.
useful for different type of UI for different dataTypes
i.e., checkbox for bool, textbox for string, number, etc.*/
//filterFn?: function(ui){},
/*condition applicable to number and date dataType (amongst date,number,string,bool)
converts cell and filter values into native data types making it easier for data comparison.
also makes this filter condition appear in header menu filter condition dropdown for the columns having these dataType.*/
number: 1, date: 1,
//even though condition applies to number and date, still show this condition in
//string dataType columns. (amongst boolList, dateList, numberList, stringList )
stringList: 1,
//compare function does the actual filtering.
compare: function (cellData, val, val2) {
//debugger;
return (cellData < val || cellData > val2)
}
}
//assign localization string to condition.
$.paramquery.pqGrid.defaults.strConditions.notbetween = "Not between";
This is a callback function that may return same properties as column.filter dynamically.
column.fmtDateEditType: String
(v10.0.0) It works same as global fmtDateEdit option but specific to the column.
column.fmtDateFilterType: String
(v10.0.0) It works same as global fmtDateFilter option but specific to the column.
column.fmtNumberEditType: String
(v10.0.0) It works same as global fmtNumberEdit option but specific to the column.
column.fmtNumberFilterType: String
(v10.0.0) It works same as global fmtNumberFilter option but specific to the column.
It sets the display format for numbers and datetime values in a column using a string or a callback function.
- If a callback function is used, then the corresponding
column.deFormat must also be provided.
- If a string format is used, then the cell data and the format are exported separately.
Notes:
- Use same Excel formatting rules for numbers and datetime values
- When using a string format, Excel receives the raw value + format rule.
- When using a callback, the formatted value is exported to Excel as a string.
String formats follow the same rules as Excel.
To define number formats, you can specify up to four sections, separated by semicolons (;):
- Positive numbers
- Negative numbers
- Zero values
- Text
#,###.00;(#,###.00);0.00;"gross receipts for @"
#.000
#,###.0
$#,###.00
0.00%
0.00E+00
#,###.00 €
mm-dd-yyyy
dd-mm-yy
mmmm,yyyy
mmmmm,yyyy hh:mm:ss
hh:mm AM/PM
See Excel format documentation for more examples on numbers, currency, scientific, and datetime formats:
https://support.microsoft.com/en-us/office/number-format-codes-5026bbd6-04bc-48cd-bf33-80f18b4eae68
Code examples:
Initialize the grid with column.format option specified.
var colM = [
{ dataIndx: 'revenue', dataType: "float", format: "¥#,###" },
{ dataIndx: "ShipDate", dataType: "date", format: "dd-mm-yyyy" },
{ dataIndx: "quarter", dataType: "integer",
format: function(val){
return [ 'Q1', 'Q2', 'Q3', 'Q4' ][ val ];
},
deFormat: function(val){
return { 'Q1': 0, 'Q2': 1, 'Q3': 2, 'Q4': 3 }[ val ];
}
}
];
pq.grid( selector,{ colModel: colM });
column.formatRawType: StringDefault: dd/mm/yy
This option sets the format of the date values send as parameters during remote filtering.
This option is removed in v4.0.0, use global formulas option instead of this.
By default a column is groupable except when this option is set to false.
By default a column is grouped by cell value. Custom grouping or range grouping e.g., by age groups or by months, years, etc can be done by implementing this callback. This is useful for numbers ( floats and integers ) and dates.
The callback receives cell value as argument and it should return a string by which grouping is desired.
Code examples:
Initialize the grid with column.groupChange option specified.
var colM = [
{
dataIndx: "age",
dataType: 'integer',
groupChange: function(val){
var lower = Math.floor( val/ 10 ) * 10,
upper = Math.ceil( (val + 1)/ 10 ) * 10;
return lower + " < " + upper;
}
}
];
pq.grid( selector, {colModel:colM} );
It determines the horizontal alignment of text in the column headers.
Possible values are "left", "right" and "center".
If it's undefined, then column.align is applied to column headers.
Column is hidden when this option is true.
To dynamically show/hide the columns, Columns().hide() method is recommended.
Code examples:
Initialize the grid with column.hidden option specified.
var colM = [
//1st column is hidden.
{ title: "ShipCountry", width: 100, hidden:true },
{ title: "Customer Name", width: 100 }
];
pq.grid( selector,{ colModel: colM });
Get or set the column.hidden option, after initialization:
//setter: hide 2nd column.
colM[1].hidden = true;
//refresh colModel after show/hide columns for grouped columns.
grid.refreshCM();
(v7.0.0) Defines vertical alignment of text in the column header cells.
Possible values are "top", "center" and "bottom".
Maximum possible width of the column in pixels or in percent of width of the grid.
Column width i.e., column.width, if set explicitly or computed implicitly more than value of this property is ignored.
Code examples:
Initialize the grid with column.maxWidth option specified.
//maxWidth is specified for both columns.
var colM = [
{ title: "ShipCountry", maxWidth: '80%' },
{ title: "Customer Name", maxWidth: 300 }
];
Used to display or override display of header menu icon for this column.
Used to define or override header menu structure for this column,
please refer to the main menuUI option for its structure.
Grouped column is collapsed in header menu when this is true.
Column is disabled in header menu when this is true, so checkbox state can't be changed.
column is hidden in header menu when this is true.
Minimum possible width of the column in pixels or in percent of width of the grid.
Column width i.e., column.width, if set explicitly or computed implicitly less than value of this property is ignored.
Code examples:
Initialize the grid with column.minWidth option specified.
//minWidth is specified for both columns.
var colM = [
{ title: "ShipCountry", minWidth: 100 },
{ title: "Customer Name", minWidth: '20%' }
];
column can't be dragged when this is true.
Any draggable column can't be dropped on this column when this option is true.
Read only property (shouldn't be set or changed) that points to the parent column of a column.
It is useful to traverse the hierarchy of grouped columns.
(v8.0.0) When set to false, it skips paste of data on a column
By default the pivot grouped columns are sorted alphabetically or in numeric order.
This is a callback function to customize sorting of pivot columns
It receives 2 col objects as arguments; both col objects have sortby property which are used to sort the columns.
pivotSortFn: function(col1, col2){
return (col1.sortby * 1 < col2.sortby * 1 ? 1 : -1);
}
It's a callback function used to manipulate view of the cell after whole grid view is rendered. As compared to column.render callback which is limited to returning static content only, this callback is more capable in that cell node can be further manipulated to bind individual event listeners or create fully interactive cells such as charts or graphs.
This function can be called synchronously or asynchronously depending upon value of option postRenderInterval.
Note: This callback works only when option postRenderInterval is defined.
Callback arguments ui
- cell (
Element): Cell DOM node.
- rowData (
Array or PlainObject): Reference to 1-dimensional array or object representing row data.
- rowIndx (
Integer): Zero based index of the row.
- rowIndxPage (
Integer): Zero based index of the row on current page.
- dataIndx (
Integer or String): Zero based index in array or key name in JSON.
It's a callback function to control rendering of whole cell, that returns any of the below:
- String (plain or html string) to be displayed in the cell.
- null or undefined in which case the default rendering of the cell takes place.
- Object having properties
{text, cls, attr, style} where
text is a string (plain or html string) to be displayed in the cell.
cls is the css class added to the cell.
attr is HTML attribute added to the cell.
style is css inline style added to the cell.
Cell is rendered as per the order provided below: Whenever renderer of higher priority returns null/undefined, next renderer is called or used.
- custom column.render
- Inbuilt cell renderers
- formatted value as per column.format
- raw data of the cell as per rowData[ dataIndx ]
Callback arguments ui
- rowData (
Array or PlainObject): Reference to 1-dimensional array or object representing row data.
- cellData (
any): Value of current cell.
- rowIndx (
Integer): Zero based index of the row.
- dataIndx (
Integer or String): Zero based index in array or key name in JSON.
- colIndx (
Integer): Zero based index of the column.
- formatVal (
String): Formatted value of the cell dependent upon column.format.
- Export (
Boolean): true when render callback is called during export of data.
Code examples:
Initialize the grid with column.render( ui ) option specified.
//named function
function customRenderer( ui )
//inject class, style or HTML attributes in the cell.
return {
cls: 'red',
style: 'font-weight:bold;',
attr: 'some HTML attribute'
};
};
var colM = [
{
dataIndx: "ShipCountry",
//points to named function (useful while loading colModel remotely as JSON)
render: 'customRenderer'
},
{
dataIndx: "Region",
render: function( ui )
//set max height of cell with help of render function.
return {
text: "" + ui.cellData + "
",
style: "height:30px;"
};
}
}
]
Callback function for partial rendering ( label beside checkbox, icon, etc ) of a cell in checkbox column, row grouping column or treegrid column.
It's easier to use this renderer than complete renderer of a cell as the grid is still responsible for rendering the remaining content i.e., checkbox, icon etc and adding required indent to the cell.
It gets same arguments as that of column.render callback.
column.resizableType: BooleanDefault: true
Column is resizable depending upon the value of this option.
This option is applicable only in case of grouped columns and when parent column has collapsible.last === null property.
- If
true, then show this column only if parent column is open/expanded.
- If
false, then show this column only if parent column is close/collapsed.
- If
undefined, then always show this column irrespective of close/open state of parent column.
If all the children columns are getting hidden for either open or close state of parent, then first child is made visible.
Code examples:
Initialize the grid with column.showifOpen option specified.
var colM = [
{
title: 'Parent',
collapsible: { last: null },
colModel: [
{ title: "A", showifOpen: true },
{ title: "B", showifOpen: false },
{ title: "C" }
]
}
//when parent is collapsed, only "B" and "C" columns are visible.
//when parent is expanded, only "A" and "C" columns are visible.
]
(v9.0.0) This option when set to true prevents column from being exported.
This option can also be used for grouped columns.
(v9.1.0) This option skips focus on column cells while key navigation with arrow and tab keys.
column.sortableType: BooleanDefault: true
Set it to false to disable sorting for a column.
This option is used for local custom sorting. The callback function receives 3 parameters rowData1, rowData2 & dataIndx and it has to return +1 if rowData1[dataIndx] > rowData2[dataIndx], -1 if rowData1[dataIndx] < rowData2[dataIndx] and 0 if rowData1[dataIndx] and rowData2[dataIndx] are identical in sorting order.
Code examples:
Initialize the grid with column.sortType option specified.
var colM =
[
{ title: "Company", width: 100 },
{ title: "Rank", width: 100, sortType: function(rowData1, rowData2, dataIndx){
//compare rowData1[dataIndx] and rowData2[dataIndx]
`
];
pq.grid( selector, { colModel: colM } );
(v7.0.0) Defines css style for all cells in the column.
Individual cells can override the column style by rowData.pq_cellstyle[ dataIndx ]]]
Code examples:
Initialize the grid with column.style option specified.
var colM =
[
{ title: "Company", width: 100 },
{ title: "Rank", width: 100, style: {'font-weight': 'bold'} }
];
pq.grid( selector, { colModel: colM } );
(v7.0.0) Defines css style for the column header cell only.
Code examples:
Initialize the grid with column.styleHead option specified.
var colM =
[
{ title: "Company", width: 100 },
{ title: "Rank", width: 100, styleHead: {'font-weight': 'bold'} }
];
pq.grid( selector, { colModel: colM } );
Column Summary Configuration
This object is used to configure summary rows for a column, typically utilized with row grouping, grand summary rows (bottom of the grid), and tree grids.
Sub-options:
type
- Description: Specifies the aggregate function to calculate the summary value.
- Value:
- A string representing a predefined aggregate function (e.g.,
"avg", "count", "min", "max", "sum").
- or the name of a custom aggregate function.
- For row grouping, you can specify different aggregates for different columns within the summary object using the format
dataIndx: "aggregate function".
edit
- Type:
Boolean
- Description: Controls the editability of the summary cell in this specific column.
- Usage: It can be used to override the global editability setting for summary fields defined by
groupModel.summaryEdit.
Code examples:
Initialize the grid with column.summary option specified.
var colM =
[
{
dataIndx: "ShipCountry",
//for all dataIndx, default aggregate type is "min", except in case of country for which aggregate is "avg".
summary: { type: "min", edit: true, country: "avg" },
...
},
...
];
pq.grid( selector, { colModel: colM } );
Title or Heading of the column.
It can be a callback that returns html to be displayed as column title.
Class to be assigned to a column displayed in toolPanel.
It's useful to assign css styles such as background color, font stlye, etc to a column.
There is a special class "pq-deny-drag" which if assigned to a column prevents it from being dragged in toolPanel.
Code examples:
Initialize the grid with column.tpCls option specified.
var colM = [
{ title: "ShipCountry", width: 100, tpCls:'red' },
{ title: "Customer Name", width: 100 }];
pq.grid( selector, { colModel: colM } );
Hide this column in toolPanel.
Type of column. It has 2 possible values: 'checkbox' and 'detail'.
checkbox turns the whole column into checkboxes which can be used for editing cells or row selections. The display of individual checkboxes can be overridden with column.render callback. This column needs to be bound to a field with boolean ( e.g., true/ false ) or string ( e.g., 'YES'/ 'NO' ) values to save the state of the checkboxes. It's important to specify:
- appropriate
column.dataType
selection.type = null when this column is used for row selections.
column.editor = false
Please check column.cb for complementary properties.
detail turns the column into icons used to display the collapsed or expanded state of rows. It's used in conjunction with detailModel. dataIndx of this column is 'pq\_detail'. rowData[ 'pq\_detail' ][ 'show' ] == true for the expanded rows.
These special columns shouldn't be added or removed dynamically.
(v7.0.0) Checkbox column can be added or removed dynamically now.
Code examples:
Initialize the grid with column.type option specified.
var colM = [
{ title: "", width: 50, type: 'checkbox' },
{ title: "Customer Name", width: 100 }];
pq.grid( selector, { colModel: colM } );
Wraps checkbox cell of ordinary columns, row grouping or treegrid within a label.
It helps in enlarging the clickable area of a checkbox but may not be required when checkbox cell is also editable.
column.validationsType: Array
An array of objects, where each object defines a single validation or warning rule for a column or an individual cell. These rules are applied during editing or copy-paste operations.
Notes
- Validations other than
nonEmpty run only when the cell value is defined (non-null).
- Global validation options (
icon, cls, style from options.validation) can be overridden per column.
- Global warning options from
options.warning can also be overridden at the column level.
Sub-options
type
Specifies the type of validation. Supported values:
minLen – minimum allowed string length
maxLen – maximum allowed string length
gt – greater than
gte – greater than or equal to
lt – less than
lte – less than or equal to
regexp – matches a regular expression
nonEmpty – disallows empty (""), null, or undefined
neq – not equal to a given value
- custom callback function
Callback signature:
function rule({ column, value, rowData, msg }) {
// modify msg by reference if needed
}
value
The reference value used for the validation.
msg
The message displayed in the tooltip when validation or warning is triggered.
warn
Set warn: true to mark the rule as a warning instead of an error.
Code examples:
Initialize the grid with column.validations option specified.
var colM = [
{ title: "Customer Id" },
{ title: "Customer Name",
validations: [
// Required field
{ type: 'nonEmpty', msg: 'Required' },
// Warning example
{ type: 'minLen', value: 5, msg: 'Better more than 5 chars', warn: true },
]
}
];
pq.grid(selector, { colModel: colM });
(v7.0.0) It defines vertical alignment of text in the columns. Possible values are "top", "center" and "bottom".
Individual cells can override this with rowData.pq\_cellprop[ dataIndx ].valign
Code examples:
Initialize the grid with column.valign option specified.
var colM = [
{ title: "Company", width: 100, dataType: "string" },
{ title: "Rank", width: 100, dataType: "integer", valign: "center" }
];
pq.grid( selector,{colModel: colM });
Width of the column in pixels or in percent of width of the grid.
It defaults to minimum width of the column when width is not specified or when width is less than minimum width.
Code examples:
Initialize the grid with column.width option specified.
var colM = [
{ title: "ShipCountry", width: 100 },
{ title: "Customer Name", width: '50%' }];
pq.grid( selector, { colModel: colM } );
columnBordersType: BooleanDefault: true
Draws vertical borders around all the columns.
This option applies any column property to all the columns by defining them at a single place.
Tip: Use getter properties to apply the property values conditionally.
Properties defined in this option are:
- Deep cloned ( in case of nested properties ) while copying to all columns.
- Not copied to a column which already has defined value for that property, so a columnTemplate property can be overriden in individual columns.
- Properties are copied to lowermost or innermost data bound columns only for nested columns in colModel.
- colModel property can't be set in this option.
Code examples:
Initialize the grid with columnTemplate option specified.
//define all columns to have same width and minimum width unless overridden in individual columns.
pq.grid( selector, { columnTemplate: { width: '20%', minWidth: 50 } } );
//apply "mmm dd, yyyy" format to all date dataType columns.
pq.grid( selector, { columnTemplate: {
get format(){
if(this.dataType=="date"){
return "mmm dd, yyyy"
}
}
`);
Defines context menu on body cells, number cells, header cells, tabs, toolbar, etc
on
- Type:
boolean
- Description: Turns on/off the context menu.
preInit
- Type:
(evt: any, ui: any) => void
- Description:
- Callback called before every initialization/opening of context menu.
- Default browser context menu opens if this callback returns
false.
- Default implementation returns
false when ctrl or meta key is pressed.
evt: type is context event.
ui: provides detailed information about the element on which context menu is activated.
init
- Type:
(evt: any, ui: any) => void
- Description:
- Callback called during every initialization/opening of context menu.
- Default implementation adds focus to the cell on which context menu is activated.
evt: type is context event.
ui: provides detailed information about the element on which context menu is activated.
items
- Type:
itemX[] | ((evt, ui) => itemX[])
ui fields:
$td?: jQuery (body cell)
$th?: jQuery (header cell)
colIndx: number (-1 for number cell)
rowIndx: number
rowData: any
dataIndx: string (undefined for group columns)
column: object
filterRow?: boolean (true for header filter row)
itemX = citem | string
citem structure:
cls?: string (CSS class)
disabled?: boolean
icon?: string
action?: ((evt, ui, citem: citem) => boolean | void)
name: string (title of the item)
shortcut?: string (for display only)
style?: string
subItems?: Array<itemX> (nested items)
tooltip?: string
- Description:
- Array of items or callback returning array of items.
- Items can be objects or predefined string
'separator'.
- Context menu can be built dynamically via callback.
- Browser context menu opens if callback returns empty array.
- Context menu closes by default when an item with action is clicked (preventable by returning
false).
evt: type is context event.
ui: provides detailed information about the element.
- Works as fallback when
cellItems, headItems, imgItems, numItems are not defined.
bodyItems (v8.7.0)
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for empty body region. Same structure as
items.
cellItems
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for body cells. Same structure as
items.
headItems
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for header cells. Same structure as
items.
imgItems
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for images. Same structure as
items.
miscItems
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for miscellaneous grid elements (toolbar, grouping toolbar, title, footer, etc.). Same structure as
items.
numItems
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for number cells. Same structure as
items.
tabItems (v8.0.0)
- Type:
itemX[] | ((evt, ui) => itemX[])
- Description: Menu items for tabs. Same structure as
items.
itemX[ ] | ( (evt, ui) => itemX[ ] )
//where
evt.type = "context"
itemX: {
cls?: string //css class
disabled?: boolean //disabled item
icon?: string //icon displayed beside item
action?: ((evt, ui, citem: citem)=> boolean | void)
name: string //title of the item
shortcut?: string //shortcut e.g., Ctrl - V, for display only
style?: string //css style added to item title
subItems?: Array //nested items within an item
tooltip?: string //adds title attribute to the item
} | string
//ui provides detailed information about the element on which context menu is activated.
ui: {
$td?: jQuery //for body cell
$th?: jQuery //for header cell
colIndx: number //-1 for number cell
rowIndx: number
rowData: any
dataIndx: string //undefined for group columns
column: object //
filterRow?: boolean //true for header filter row
}
Code examples:
Initialize the grid with contextMenu option specified.
pq.grid( selector, { contextMenu: {
on: true,
cellItems: [
{
name: 'Undo',
action: function(evt, ui, item){
this.History().undo();
}
},
...
]
} } );
copyModelType: ObjectDefault: { on: true, render: false, header: undefined, plainFmt: undefined }
It controls the behavior when data is copied from grid with shortcut keys or with API.
- render: When render is true, formatted or rendered cells are copied instead of raw data.
column.exportRender overrides this option for individual columns.
- header: (v7.3.0) When true, it includes the header cells in copied data. It can be overridden by
header parameter of Range.copy() method.
- plainFmt: (v11.0.0) By default Clipboard carries both rich and plain format. When this option is true, only plain format is carried by clipboard.
Code examples:
Initialize the grid with copyModel option specified.
pq.grid( selector, { copyModel: { render: true } } );
dataModelType: ObjectDefault: Object
It contains information about the data in array format and various other properties related to data.
It's mandatory to pass dataModel to grid constructor.
If dataModel is changed after initialization, new value overwrites the previous value,
so it should contain all the sub-options, even the default ones.
Safer way to set it after init is to pass individual sub-options rather than complete dataModel.
Code examples:
Initialize the grid with dataModel option specified.
var dataSales = [[1, 'Exxon Mobil', '339,938.0', '36,130.0'],
[2, 'Wal-Mart Stores', '315,654.0', '11,231.0'],
...
];
pq.grid( selector, { dataModel: { data: dataSales, ... }, ... } );
Get or set the dataModel option, after initialization:
//getter
//get complete dataModel.
var dataModel = grid.option( "dataModel" );
//get sub-option of dataModel.
var data = grid.option( "dataModel.data" );
//setter
//either new value should contain all sub-options
grid.option( "dataModel", { data: dataSales, ... } );
//or pass individual sub-options which is safer.
grid.option( "dataModel.data", new_data );
dataModel.beforeSend( jqXHR, settings )Type: Function
This option is relevant only when dataModel.location is remote.
It's a callback function which can be used to modify jqXHR before it's sent.
Use this to set custom headers, etc. The jqXHR and settings maps are passed as arguments.
This is an Ajax Event. Returning false in the beforeSend function will cancel the request.
Code examples:
Initialize the grid with dataModel.beforeSend( jqXHR, settings ) option specified.
pq.grid( selector, { dataModel:{ beforeSend: function( jqXHR, settings ){
`);
dataModel.contentTypeType: String
This option is relevant only when dataModel.location is remote.
When sending data to the server, use this option to override default content-type
header determined by $.ajax request.
In some frameworks e.g., ASP.NET webforms it's required to set content-type explicitly
to 'application/json; charset=UTF-8' while sending JSON data to the server.
Code examples:
Initialize the grid with dataModel.contentType option specified.
pq.grid( selector, { dataModel: {
contentType :'application/json; charset=UTF-8' ` );
dataModel.dataType: ArrayDefault: [ ]
Reference to a 2-dimensional array (array of arrays) or JSON (array of key/value paired plain objects).
Local requests use this option to directly pass data to grid. Remote requests use dataModel.url / dataModel.getUrl and dataModel.getData options to feed data to grid.
The data for both local and remote requests reside in dataModel.data.
It's important to note that when data is array of objects, dataIndx in colModel should be strings matching with keys in the objects
i.e., for the below data format, dataIndx for first column should be 'rank'.
When data is array of arrays, dataIndx in colModel should be either integers or can be omitted.
Code examples:
Initialize the grid with dataModel.data option specified.
//array of arrays
var dataSales = [[ 1, 'Exxon Mobil', '339,938.0', '36,130.0' ],
[ 2, 'Wal-Mart Stores', '315,654.0', '11,231.0' ],
[ 3, 'Royal Dutch Shell', '306,731.0', '25,311.0' ],
[ 4, 'BP', '267,600.0', '22,341.0' ],
[ 5, 'General Motors', '192,604.0', '-10,567.0' ] ];
//or array of objects
var dataSales = [
{ rank:1, company: 'Exxon Mobil', revenues: '339,938.0', profits: '36,130.0' },
{ rank:2, company: 'Wal-Mart Stores', revenues: '315,654.0', profits: '11,231.0' },
{ rank:3, company: 'Royal Dutch Shell', revenues: '306,731.0', profits: '25,311.0' },
{ rank:4, company: 'BP', revenues: '267,600.0', profits: '22,341.0' },
{ rank:5, company: 'General Motors', revenues: '192,604.0', profits: '-10,567.0' } ];
//Initialize grid with data.
pq.grid( selector, { dataModel: { data: dataSales } } );
Get or set the dataModel.data option, after initialization:
//getter
var data = grid.option( "dataModel.data" );
//setter
grid.option( "dataModel.data", dataSales );
//setter of dataModel.data is followed by refreshDataAndView method call.
grid.refreshDataAndView()
dataModel.dataTypeType: StringDefault: "JSON"
This option is relevant only when dataModel.location is remote.
Data Type of response from server in case of remote request. Possible values are "TEXT", "XML", "JSON" or "JSONP".
Code examples:
Initialize the grid with dataModel.dataType option specified.
pq.grid( selector, {dataModel:{ dataType: "XML"} } );
dataModel.error( jqXHR, textStatus, errorThrown )Type: Function
This option is relevant only when dataModel.location is remote.
Callback handler for Ajax error.
Code examples:
Initialize the grid with dataModel.error( jqXHR, textStatus, errorThrown ) option specified.
pq.grid( selector, {dataModel:{error:function( jqXHR, textStatus, errorThrown ){} ` );
dataModel.getData( response, textStatus, jqXHR )Type: Function
This option applies when dataModel.location is remote. It's a callback to process the remote data for the grid.
Examples:
- if remote data is in any other format e.g. XML then this callback can convert it into 2 dimensional array or array of objects.
- if remote data contains strings for number columns, it can be parsed to numbers.
In case of remote paging, this callback returns an object containing data (data for the grid), curPage ( current page ) and totalRecords
In case of no paging, this callback returns an object containing data (data for the grid) only.
Code examples:
Initialize the grid with dataModel.getData( response, textStatus, jqXHR ) option specified.
pq.grid( selector,{
dataType:"JSON",
dataModel:{
getData:function( dataJSON, textStatus, jqXHR ){
dataJSON.data.forEach((rowData)=>{
rowData.price = parseFloat(rowData.price); //parse the number values.
});
return { data: dataJSON.data, curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords };
}
}
);
Get or set the dataModel.getData( response, textStatus, jqXHR ) option, after initialization:
//getter
var getData=grid.option( "dataModel.getData" );
//setter
pq.grid( selector,"option","dataModel.getData",function( response, textStatus, jqXHR ){});
dataModel.getUrl( { colModel, dataModel, filterModel, groupModel, pageModel, sortModel } )Type: Function
This is a callback function that returns the URL and data for GET or POST requests.
Note:
- This option applies only when
dataModel.location is remote or lazy.
- If this option is specified,
dataModel.url will be ignored.
- It overrides all fields sent by the grid for remote requests. If you need to append custom parameters to the fields already sent by the grid (which is common), use
dataModel.postData instead.
Code examples:
Initialize the grid with dataModel.getUrl( { colModel, dataModel, filterModel, groupModel, pageModel, sortModel } ) option specified.
pq.grid( selector, { dataModel:{ getUrl: function(){
return { url: "/https/paramquery.com/demos/pagingGetOrders", data: {key1:val1,key2:val2,key3:val3} };
`);
Get or set the dataModel.getUrl( { colModel, dataModel, filterModel, groupModel, pageModel, sortModel } ) option, after initialization:
//getter
var getUrl=grid.option( "dataModel.getUrl" );
//setter
grid.option( "dataModel.getUrl", function(){});
dataModel.locationType: StringDefault: "local"
Specifies the dataModel.location of the grid. Possible values are local, remote, or lazy.
local
The grid reads data from dataModel.data, which must be set manually. “Local” refers to the grid’s perspective — the data itself can still be loaded from a server via AJAX. Supports only local filtering, paging, and sorting.
remote
The grid automatically sends and receives data from the server. It becomes temporarily unresponsive while loading. Either dataModel.url or dataModel.getUrl must be specified. Supports both local and remote filtering, paging, and sorting.
lazy
The grid loads data from the server in batches, keeping it responsive during background loading. Recommended for large datasets that take time to load in a single request. Requires dataModel.url and remote paging implementation on the server. Supports both local and remote filtering and sorting.
Code examples:
Initialize the grid with dataModel.location option specified.
pq.grid( selector, { dataModel:{ location:"remote" } } );
Get or set the dataModel.location option, after initialization:
//getter
var location=grid.option( "dataModel.location" );
//setter
grid.option( "dataModel.location", "remote" );
dataModel.methodType: StringDefault: "GET"
This option is relevant only when dataModel.location is remote.
Method to use to fetch data from server in case of remote request. Possible values are "GET" and "POST".
Code examples:
Initialize the grid with dataModel.method option specified.
pq.grid( selector, {dataModel: {method: "POST" } } );
Applicable when dataModel.location is remote or lazy. Use this option to include any custom JSON data that should be sent to the server. The data is serialized and appended to the request payload sent by the grid. When defined as a callback, it receives an object { colModel: colModel, dataModel: dataModel } as its parameter. For example, if postData = { key1: value1, key2: value2 }, it is converted to the query string key1=value1&key2=value2.
Code examples:
Initialize the grid with dataModel.postData option specified.
pq.grid( selector, {dataModel: { postData: {gridId:23, table: "products"} ` );
Get or set the dataModel.postData option, after initialization:
//getter
var postData=grid.option( "dataModel.postData" );
//setter
grid.option( "dataModel.postData", function( ui ){
return {table: "products"};
} );
dataModel.postDataOnceType: Object
This option is relevant when dataModel.location is either remote or lazy.
Any custom data to be sent to the server can be put here.
postDataOnce value is send to server only once and it loses its value after that.
Code examples:
Initialize the grid with dataModel.postDataOnce option specified.
pq.grid( selector, {dataModel: { postDataOnce: {gridId:23, table: "products"} ` );
Get or set the dataModel.postDataOnce option, after initialization:
//getter
var postDataOnce =grid.option( "dataModel.postDataOnce" );
//setter
grid.option( "dataModel.postDataOnce", { table: "products" } );
dataModel.progressAcrossTabsType: boolean
(v8.6.0) When true, progress bar for lazy loading data in one tab is displayed across all tabs.
Code examples:
Initialize the grid with dataModel.progressAcrossTabs option specified.
pq.grid( selector, {dataModel: { progressAcrossTabs: true` );
Identifier / dataIndx of primary key of the record.
This option is mandatory for tracking of transactions in the grid.
Some of the important transactional methods are isDirty(),
getChanges(), commit() and rollback().
Code examples:
Initialize the grid with dataModel.recIndx option specified.
pq.grid( selector, {dataModel:{ recIndx: "id"} } );
Applicable when dataModel.location is remote or lazy.
Specifies the absolute or relative URL used by the grid to fetch remote data and send requests (GET or POST) for sorting, paging, filtering, etc.
Either dataModel.getUrl or dataModel.url must be defined — getUrl takes precedence if both are provided.
Code examples:
Initialize the grid with dataModel.url option specified.
pq.grid( selector, { dataModel:{ url: "/https/paramquery.com/demos/pagingGetOrders" } } );
Get or set the dataModel.url option, after initialization:
//getter
var url = grid.option( "dataModel.url" );
//setter
grid.option( "dataModel.url", "http://paramquery.com/getOrders" );
detailModelType: ObjectDefault: See below
Used to define row details or nested grids within the main grid.
When frozen columns are enabled, the detail view is rendered in the unfrozen pane.
Sub-options:
cache (Boolean, default: true)
Determines whether the detail view is cached.
When set to false, expanding or collapsing a row refreshes its detail data and view.
hasChild (Function, default: undefined)
(v9.1.0)
Callback that receives rowData and returns a boolean indicating whether the row has a child or detail view.
init (Function, default: undefined)
Callback that receives:
{ rowData: rowData }
and returns the detail view as a jQuery object.
collapseIcon (String, default: "ui-icon-triangle-1-e")
Icon displayed when a row is collapsed.
expandIcon (String, default: "ui-icon-triangle-1-se")
Icon displayed when a row is expanded.
header (Boolean, default: undefined)
(v8.7.0)
Displays an icon in the header cell to expand or collapse all detail views simultaneously.
height (Integer or String, default: "auto")
Height of the detail row.
Can be a fixed number or "auto" to match content height (v8.0.0).
Code examples:
Initialize the grid with detailModel option specified.
pq.grid( selector, {"detailModel": {
cache:false,
init: function(ui){
var rowData = ui.rowData;
return $template;
}
`);
(v7.6.0) css selector of a DOM node which is taken as reference for computing percent dimensions of the grid.
When either grid width or height or both options are mentioned in percent, they are computed relative to the grid's immediate parent by default. This option when specified is used as reference element instead.
Code examples:
Initialize the grid with dimsRelativeTo option specified.
pq.grid( selector, dimsRelativeTo: 'body' );
dragColumnsType: ObjectDefault: {enabled: true, acceptIcon: 'ui-icon-check', rejectIcon: 'ui-icon-closethick', topIcon: 'ui-icon-circle-arrow-s', bottomIcon:'ui-icon-circle-arrow-n' }
The columns can be reordered by drag and drop. It can be enabled or disabled and the icons can be changed using various sub options.
Code examples:
Initialize the grid with dragColumns option specified.
pq.grid( selector, dragColumns: { enabled: false } );
draggableType: BooleanDefault: false
The grid as a whole becomes draggable if this option is set to true.
Please check dragModel if you are looking for draggability of individual rows.
Code examples:
Initialize the grid with draggable option specified.
pq.grid( selector, {draggable: true} );
Get or set the draggable option, after initialization:
//getter
var draggable=grid.option( "draggable" );
//setter
grid.option( "draggable", true );
Draggable Rows Configuration
Configures properties for draggable rows in the grid.
A Drag instance is added to the draggable helper through the jQuery data() method so that droppable controls can access and call Drag methods on this draggable.
Options
on
- Type:
boolean
- Description: Makes grid rows draggable when
true.
afterDrop
- Type:
(evt: any, uiDrop: any) => void
- Description: Called when drag-and-drop occurs between different grids, just after
dropModel.drop callback is called.
No default implementation.
beforeDrop
- Type:
(evt: any, uiDrop: any) => void
- Description: Called when drag-and-drop occurs between different grids, just before
dropModel.drop callback is called.
Default implementation removes nodes from the draggable grid, treegrid, or row groupings.
clsDnD
- Type:
string
- Default:
pq-dnd
- Description: Class assigned to draggable control in this grid, used by droppable controls to decide acceptance.
clsNode (v7.4.0)
- Type:
string
- Default:
pq-dnd-drag
- Description: Class assigned to dragged row(s).
contentHelper
- Type:
(diHelper: Array<string>, dragItems: Array<any>) => string
- Example:
function(diHelper, dragNodes){
var rd = dragNodes[0], len = dragNodes.length;
return diHelper.map(function(di){ return rd[di] }).join(", ") +
(len > 1 ? " ( " + dragNodes.length + " )" : "");
}
- Description: Callback function to return content of helper.
cssHelper
- Type:
object
- Default:
{
opacity: 0.7,
position: 'absolute',
height: 25,
width: 200,
overflow: 'hidden',
background: '#fff',
border: '1px solid',
boxShadow: '4px 4px 2px #aaaaaa',
zIndex: 1001
}
- Description: CSS properties applied to draggable helper.
diDrag
- Type:
number | string
- Default:
-1
- Description:
dataIndx of column which displays the draggable UI.
Number column is used when value is -1.
diHelper
- Type:
Array
- Description: Array of
dataIndx values of columns whose values are displayed in the draggable helper.
dragNodes
iconAccept
- Type:
string
- Default:
'ui-icon ui-icon-check'
- Description: Class of the accept icon displayed in helper.
iconReject
- Type:
string
- Default:
'ui-icon ui-icon-cancel'
- Description: Class of the reject icon displayed in helper.
isDraggable
options
- Type:
object
- Description: Options taken from jQueryUI draggable API (some may not work).
tmplDrag
tmplDragN
tmplHelper
Code examples:
Initialize the grid with dragModel option specified.
pq.grid( selector, {dragModel: {on: true` );
Drop Properties Configuration
Configures drop properties so that the grid can accept row objects from itself, other grids, row groupings, treegrid, or third‑party draggables (based on jQueryUI only).
Also see the moveNode event to write any custom action upon completion of drag & drop.
Options
on: boolean
- Description: Makes a grid droppable when
true.
accept: string`
- Default:
'.pq-dnd'
- Description: CSS selector of accepted draggable components.
Multiple selectors can be defined by separating them with commas, e.g. '.cls1,.cls2,.cls3'.
clsParent: string
- Default:
pq-dnd-parent
- Description: CSS class assigned to potential parent of the dragged node.
divider: integer
- Description: Creates a vertical divider line in the treegrid to differentiate between potential parents depending on the dragged node helper’s position (left or right of the line).
isDroppable: (evt: any, ui: any) => (void | boolean)
ui object fields:
{
rowIndx: number,
rowData: any,
$cell: jQuery,
draggable: jQuery,
helper: jQuery,
ratioY: (() => number),
colIndx: number
}
- Description:
- By default, all rows in the grid accept draggable items.
- This callback is called when draggable items are moved over different rows.
- Returning
false rejects the draggable items.
evt is derived from the jQueryUI draggable drag event.
ui provides grid‑specific fields in addition to draggable event fields.
rowIndx and rowData give info about the row being dragged over.
ratioY() returns a value between 0 and 1 depending on proximity to the top or bottom of the row.
- Must check availability of row fields (they are undefined when dragging over empty space or when grid has no rows).
- Draggable object reference can be obtained from
ui.helper.data('Drag').
- Row info can be obtained from
Drag.getUI(). See Drag API for details.
drop: (evt: any, ui: any) => void
ui object fields:
{
rowIndx: number,
rowData: any,
$cell: jQuery,
draggable: jQuery,
helper: jQuery,
ratioY: (() => number),
colIndx: number
}
- Description:
- Called when accepted draggable items are finally dropped.
evt is derived from the jQueryUI droppable drop event.
ui provides grid‑specific fields in addition to droppable event fields.
rowIndx and rowData give info about the row being dropped onto.
ratioY() returns a value between 0 and 1 depending on proximity to top or bottom of the row.
- Row fields are undefined when dropped over empty space or when grid has no rows.
- Default implementation: Handles common DnD scenarios within/between grids, grouped rows, and treegrid using
moveNodes.
- You can override this callback with your own implementation.
- Draggable object reference can be obtained from
ui.helper.data('Drag').
- Row info can be obtained from
Drag.getUI(). See Drag API for details.
options: object
- Description: Options taken from jQueryUI droppable API (note: some options may not work).
Code examples:
Initialize the grid with dropModel option specified.
pq.grid( selector, {dropModel: {on: true` );
Editing can be disabled for all columns by setting it to false or a callback function can be implemented.
Callback receives ui:{ rowData: rowData, rowIndx: rowIndx} as argument.
(v6.0.0) This option value or callback return value of true / false has lower priority than column.editable option while deciding final editability of a cell in grid.
Code examples:
Initialize the grid with editable option specified.
pq.grid( selector, {editable:false} );
Get or set the editable option, after initialization:
//getter
var editable=grid.option( "editable" );
//setter
grid.option( "editable", false );
grid.option( "editable", function( ui ){
return !this.hasClass({rowIndx: ui.rowIndx, cls: 'pq-delete' });
});
Configures key navigation and other editor properties.
Options
addDisableCls
- Type: Boolean
- Default: (empty)
- Description:
- Added in v7.0.0.
- When true, adds the
pq-cell-disable CSS class to disabled cells.
allowInvalid
- Type: Boolean
- Default:
false
- Description:
- When true, invalid values are not rejected.
- Instead, the class
invalidClass is added to the cell.
clicksToEdit
- Type: Integer
- Default:
2
- Description:
- Number of clicks required to enter edit mode.
1 = single click, 2 = double click.
filterKeys
- Type: Boolean
- Default:
true
- Description: Prevents non-digit characters in float and integer dataType columns.
invalidClass
- Type: String
- Default:
'pq-cell-red-tr pq-has-tooltip'
- Description: Class added when
allowInvalid is true and validation fails.
keyUpDown
- Type: Boolean
- Default: (empty)
- Description:
- Up/down arrow keys move focus to the cell above or below while editing.
- v7.3.0 change: default changed from
true to undefined.
onBlur
- Type: String
- Default:
'validate'
- Description: Controls behavior when the editor loses focus.
validate: stays in edit mode until validation succeeds.
save: saves the value if valid, exits edit mode even if invalid.
"": does nothing; editor stays in edit mode.
onSave
- Type: String
- Default:
'nextFocus'
- Description: Cell navigation when the save key is pressed in editor. Values:
nextEdit: edits next editable cell (right → down).
nextFocus: focuses the next cell to the right (or left with Shift).
downFocus (v7.3.0): focuses the cell below (or above with Shift).
"": focus stays on the same cell.
onTab
- Type: String
- Default:
'nextFocus'
- Description: Cell navigation when Tab is pressed in editor; uses the same values as onSave.
pressToEdit
- Type: Boolean
- Default:
true
- Description: Starts edit mode when any input key is pressed while the cell is focused.
saveKey
- Type: Integer
- Default:
$.ui.keyCode.ENTER
- Description:
- Key that triggers save, in addition to Tab.
- Alt+Enter inserts line breaks in multiline editors (e.g.,
textarea).
- v7.5.0: Enter alone can create line breaks in multiline editors if this option is set to any value other than
$.ui.keyCode.ENTER.
warnClass
- Type: String
- Default:
'pq-cell-blue-tr pq-has-tooltip'
- Description: Class added when a cell fails a warning-level validation.
Note:
filterKeys, keyUpDown, and saveKey can be overridden per column using column.editModel.
Code examples:
Initialize the grid with editModel option specified.
//double click to edit cell and enter key saves the cell.
pq.grid( selector, {editModel: { clicksToEdit: 2, saveKey: $.ui.keyCode.ENTER } );
Get or set the editModel option, after initialization:
//getter
var editModel=grid.option( "editModel" );
//setter
var editModel = {
clicksToEdit: 1,
saveKey: $.ui.keyCode.ENTER
};
grid.option( "editModel", editModel );
It provides the editor properties for the whole grid.
Options
attr
- Type: String
- Default: (empty)
- Description: Adds an HTML attribute to the editor.
cls
- Type: String
- Default: (empty)
- Description: Adds a CSS class to the editor.
getData
- Type: function
- Default: (empty)
- Description:
- Added in v8.2.0.
- A callback function used to return custom data or value from a custom editor.
init
- Type: function
- Default: (empty)
- Description:
- Added in v8.2.0.
- A callback function used to initialize or convert a simple HTML control (
textbox, select, etc.) defined by type into a custom editor such as datepicker, autocomplete, or any other UI plugin.
select
- Type: Boolean
- Default: (empty)
- Description: Selects text inside the cell editor when it receives focus.
style
- Type: String
- Default: (empty)
- Description: Adds inline CSS styles to the editor.
type
- Type: String
- Default:
'contenteditable'
- Description:
- Defines the editor type:
'contenteditable', 'textbox', 'textarea', 'select', or a callback that returns the editor type.
- v8.4.0 changes:
- Default changed from
'textarea' to 'contenteditable'.
- New-line insertion with Alt+Enter moved to
'contenteditable'.
Note: Editor options can be overridden per column using column.editor.
Code examples:
Initialize the grid with editor option specified.
//make input box as default editor with round corners.
pq.grid( selector, {editor: { type: 'textbox', style: 'border-radius:5px;' } } );
Get or set the editor option, after initialization:
//getter
var editor = grid.option( "editor" );
//setter
var editor = {
type: 'textarea',
cls: 'custom-class'
};
grid.option( "editor", editor );
fillHandleType: StringDefault: 'all'
Controls the fill handle, a small square at the bottom-right corner of a selected range of cells. Dragging the fill handle horizontally or vertically copies or autofills the contents of the initial selection to other cells.
Possible values:
'' : Disables the fill handle.
'horizontal' : Enables the fill handle only for horizontal dragging.
'vertical' : Enables the fill handle only for vertical dragging.
'all' : Enables the fill handle in both horizontal and vertical directions.
Code examples:
Initialize the grid with fillHandle option specified.
pq.grid( selector, { fillHandle: 'vertical' } );
Get or set the fillHandle option, after initialization:
//getter
var fillHandle = grid.option( "fillHandle" );
//setter
grid.option( "fillHandle", '' );
It describes the filtering behavior of the grid.
Options
on
- Type: boolean
- Default:
true
- Description: Enables or disables filtering.
menuIcon
- Type: boolean
- Default: (empty)
- Description:
- Shows the filter menu icon in the header filter row when
menuIcon is true
- Can be overridden at column level using column.filter.menuIcon.
gridOptions
- Type: object
- Default: (empty)
- Description: Default options for the grid inside the filter menu (range condition).
mode
- Type: string
- Default:
"AND"
- Description: Determines how multiple columns are filtered together.
Possible values: "AND" or "OR".
header
- Type: boolean
- Default: (empty)
- Description: Shows column filter input controls in the header row when
header is true.
hideClearIcon
- Type: boolean
- Default: (empty)
- Description:
- Added in v10.1.0.
- Hides the clear icon in filter UI textboxes when set to true.
hideRows
- Type: boolean
- Default: (empty)
- Description:
- Normally, filtered rows are separated from non-filtered rows:
- filtered →
dataModel.data
- non-filtered →
dataModel.dataUF
- When
hideRows is true, filtered rows become visible and non-filtered rows are hidden, but both remain inside dataModel.data.
- Supported in plain grid and (since v8.0.0) tree grid.
timeout
- Type: integer
- Default:
400
- Description:
- Used when
column.filter.listener = 'timeout'.
- Filtering is triggered after the number of milliseconds specified by
timeout.
type
- Type: string
- Default:
'local'
- Description:
- Determines whether filtering is performed locally or remotely.
- Allowed values:
'local', 'remote'.
Code examples:
Initialize the grid with filterModel option specified.
pq.grid( selector, { filterModel: { header: true } } );
Get or set the filterModel option, after initialization:
//getter
var filterModel=grid.option( "filterModel" );
//setter
grid.option( "filterModel", { on: false, mode : "OR" } );
flexType: ObjectDefault: {on: true, one: false, all: true}
Configures the column flex (autofit) feature to set column width so all cell content is visible without wrap. It's activated by double-clicking a header's right edge or calling the flex method.
on: Toggles flex feature on/off
one: Applies flex once on grid creation and data load.
all: If true, affects all columns; if false, affects only the target column when right edge of any column's header is double clicked / tapped.
Code examples:
Initialize the grid with flex option specified.
pq.grid( selector, { flex: { on: true } } );
Get or set the flex option, after initialization:
//getter
var flex = grid.option( "flex" );
//setter
grid.option( "flex", { on: false } );
(v10.0.0) It sets Excel-like format of all datetime values displayed in the grid or spreadsheet e.g.,
| Cell value ( ISO format ) |
fmtDate |
localeFmt |
Result |
| 2023-12-03 |
dd-mm-yyyy |
|
03-12-2023 |
| 2023-12-03 |
mmm, yyyy |
en |
Dec, 2023 |
| 2023-12-03 |
mmm, yyyy |
ja |
十二月, 2023 |
| 2023-12-03 14:45 |
mmmm, yyyy hh:mm AM/PM |
en |
December, 2023 02:45 PM |
| 2023-12-03 14:45 |
mmmm, yyyy hh:mm AM/PM |
ar |
ديسمبر, 2023 02:45 م |
| 2023-12-03 14:45 |
hh:mm AM/PM |
en |
02:45 PM |
The localeFmt option can be omitted to adapt automatically to the user’s locale.
This setting is overridden by column.format, cell level, or row level formats.
Code examples:
Initialize the grid with fmtDate option specified.
pq.grid( selector, { fmtDate: 'dd-mm-yyyy' });
(v10.0.0) It sets Excel-like format of datetime values in a cell editor.
See fmtDate option for examples.
This option is also used to parse the datetime entered by user back to ISO format.
It can be overridden by column.fmtDateEdit for a specific column.
Code examples:
Initialize the grid with fmtDateEdit option specified.
pq.grid( selector, { fmtDateEdit: 'dd-mm-yyyy' });
(v10.0.0) It sets Excel-like format of datetime values in a column filter editor.
See fmtDate option for examples.
This option is also used to parse the datetime entered by user back to ISO format.
It can be overridden by column.fmtDateFilter for a specific column.
Code examples:
Initialize the grid with fmtDateFilter option specified.
pq.grid( selector, { fmtDateFilter: 'dd-mm-yyyy' });
(v10.0.0) It sets Excel-like format of all number values displayed in the grid / spreadsheet e.g.,
| Cell value |
fmtNumber |
localeFmt |
Result |
| 12345678.9 |
#,###.00 |
en-US |
12,345,678.90 |
| 12345678.9 |
#,###.00 |
de |
12.345.678,90 |
| 12345678.9 |
#,###.00 |
en-IN |
1,23,45,678.90 |
| 0.0000000000046 |
0.00E+00 |
|
4.60e-12 |
| 7849999999 |
0.00E+00 |
|
7.85e+9 |
| 0.4 |
#,###.00 % |
|
40.00 % |
The localeFmt option can be omitted to adapt automatically to the user’s locale.
It's overridden by column.format, cell level or row level format if any.
Code examples:
Initialize the grid with fmtNumber option specified.
pq.grid( selector, { fmtNumber: '#,###.00' });
(v10.0.0) It sets Excel-like format of number values in a cell editor.
See fmtNumber for examples.
This option is also used to parse the number entered by user back to js integer / float value.
It can be overridden by column.fmtNumberEdit for a specific column.
Code examples:
Initialize the grid with fmtNumberEdit option specified.
pq.grid( selector, { fmtNumberEdit: '#,###.00' });
(v10.0.0) It sets the Excel-like format of number values in a column filter editor.
See fmtNumber for examples.
This option is also used to parse the number entered by user back to js integer / float value.
It can be overridden by column.fmtNumberFilter for a specific column.
Code examples:
Initialize the grid with fmtNumberFilter option specified.
pq.grid( selector, { fmtNumberFilter: '#,###.00' });
(v11.1.0) focus and keyboard navigation related options:
focusable (boolean, default: true)
When true, allows cells to receive focus and display the focus outline.
When false, cells cannot receive focus, and the focus outline is not shown.
onTab (string, default: 'nextFocus')
Controls how the Tab key behaves within the grid:
"nextFocus"
Moves focus to the next cell in reading order:
- In LTR mode, focus moves to the cell on the right
- In RTL mode, focus moves to the cell on the left
- At the end of a row, it moves to the first cell of the next row
- Shift+Tab moves focus in the reverse direction
""
Focus leaves the grid and moves to the next focusable control on the page, instead of navigating between grid cells.
Code examples:
Initialize the grid with focusModel option specified.
pq.grid( selector, {focusModel: { onTab: 'nextFocus' } } );
Get or set the focusModel option, after initialization:
//getter
var focusModel=grid.option( "focusModel" );
//setter
grid.option( "focusModel", { focusable: false } );
This option defines computed column formulas — expressions that calculate a column’s value based on other cell values in the same row.
Formulas are declared after their dependent columns, ensuring that all referenced values are available before evaluation.
The formula function receives two parameters:
rowData — the complete data of the current row
column — metadata of the current column being computed
Code examples:
Initialize the grid with formulas option specified.
var formulas = [
//profit is dataIndx of the column.
["profit", function( rd ){
//dependent upon revenues and income.
return rd.revenues - rd.income;
}],
//tax is dataIndx of the column.
["tax", function( rd ){
//dependent upon profit.
return rd.profit * 0.25;
}]
];
pq.grid( selector, {formulas: formulas} );
formulasModelType: ObjectDefault: {on: true}
This option enables support for Excel like formulas in the cells. It can be turned off by setting { on: false }.
Code examples:
Initialize the grid with formulasModel option specified.
pq.grid( selector, {formulasModel: {on: false` );
freezeBordersType: BooleanDefault: true
this option displays borders for frozen panes.
Code examples:
Initialize the grid with freezeBorders option specified.
pq.grid( selector, {freezeBorders: false} );
Get or set the freezeBorders option, after initialization:
//getter
var freezeBorders = grid.option( "freezeBorders" );
//setter
grid.option( "freezeBorders", false );
Total number of frozen columns in the viewport. The frozen columns remain fixed while non-frozen columns can be scrolled horizontally.
It includes hidden columns so e.g., if this option is set to 4 and there are 2 hidden columns in the first 4 columns,
then only 2 columns would appear to be frozen in the viewport.
Code examples:
Initialize the grid with freezeCols option specified.
pq.grid( selector, {freezeCols:2} );
Get or set the freezeCols option, after initialization:
//getter
var freezeCols=grid.option( "freezeCols" );
//setter
grid.option( "freezeCols", 1 );
The number of rows which can be frozen similar to MS Excel. The frozen rows remain fixed while non-frozen rows can be scrolled vertically.
Code examples:
Initialize the grid with freezeRows option specified.
pq.grid( selector, {freezeRows:2} );
Get or set the freezeRows option, after initialization:
//getter
var freezeRows=grid.option( "freezeRows" );
//setter
grid.option( "freezeRows", 1 );
Used to configure row grouping and pivot grid.
groupModel.on enables grouping
groupModel.pivot enables pivot
- Grouping/pivot add row props:
pq_gtitle, pq_gsummary, pq_grandsummary, pq_level, pq_close
- Use
Group().option() only after initialization
- Summary rows:
- via
agg (v5.1.0+)
- older:
column.summary
column.renderLabel can partially render group titles/cells
Group / Pivot Options
agg:object — aggregation mapping per column { dataIndx: "min"|"sum"|"max"|"avg" }
Example: { silver: "min", gold: "sum" }
collapsed:array — collapse/expand state per level e.g., [ false, true ]. All expanded by default.
dataIndx:array — grouping fields (e.g., ["country","age"])
fixCols:boolean — fix grouped columns left (ignored if titleIndx or titleInFirstCol)
grandSummary:boolean — show grand summary at bottom
groupCols:array — pivot column groups (e.g., ["year","sport"])
header:boolean — show grouping toolbar (drag/drop grouped columns)
headerMenu:boolean — enable menu for toggling group options
hideLines:boolean — (v9.1.0) hide hierarchy lines
icon:array — expand/collapse icons (default [ 'ui-icon-triangle-1-se', 'ui-icon-triangle-1-e' ])
indent:number — per-level indent = indent × level; default: undefined (no indent)
(v11.1.0) values ≤ 3 are treated as em, values > 3 as px.
menuItems:array — items in grouping toolbar menu ("merge", "fixCols", "grandSummary")
merge:boolean — vertically merge equal grouped values
nodeClose:object — { nodeId: boolean } open/close state (pq_close) of individual nodes
on:boolean — enable/disable grouping
pivot:boolean — enable pivot mode
pivotColsTotal:string — "after"|"before"|"hideifOpen"|""
pivotTotalForSingle:boolean — show total even for single pivot column
showSummary:array — summary row visibility per level
summaryEdit:boolean — summary fields editable; respects: editable, column.editable, column.summary.edit
skipSingleSummary:boolean — (v7.0.0) skip summary for single-row groups
summaryInTitleRow:string — ""|"collapsed"|"all" summary visibility in title row
title:array — strings/callbacks for partial title rendering
Priority: column.renderLabel > groupModel.title > groupModel.titleDefault
titleInFirstCol:boolean — hierarchical titles in first visible column
titleDefault:string|function — group title template (default {0} ({1})) where {0} is value and {1} is no of items
titleIndx:string — column to show hierarchical group titles
Checkbox Options
cascade:boolean — synchronized parent-child checking
cbId:string — checkbox value field (pq_group_cb)
checkbox:boolean — checkbox in first column (requires titleInFirstCol)
checkboxHead:boolean — header checkbox
maxCheck:number — max allowed checked items
select:boolean — checkbox binds to row selection
useLabel:boolean — wrap checkbox cell in <label>
Priority: column.useLabel > groupModel.useLabel
Code examples:
Initialize the grid with groupModel option specified.
pq.grid( selector, {groupModel: { dataIndx: ["ShipCountry"] } } );
Get or set the groupModel option, after initialization:
//getter
var groupModel = grid.option( "groupModel" );
//setter
//group by ShipCountry and keep it collapsed.
grid.Group().option({
dataIndx: ['ShipCountry'],
collapsed: [ true ]
});
Height of the grid in number of pixels (without 'px' suffix) i.e., 150, percent (%) i.e., '80%' or flex. When % format is used, height is calculated relative to the immediate parent of grid unless dimsRelativeTo is specified. It can also be described as combination of both percent & pixel i.e., '100%-20' or '50%+10'. % format is supported only when immediate parent of the grid has fixed height. % format is also supported when HTML body is direct parent of grid since v2.3.0. The grid height becomes sum total of all the rows on current page when height is flex. Note that refresh method should be called when height is changed dynamically through setter.
Code examples:
Initialize the grid with height option specified.
pq.grid( selector, {height: 400} );
Get or set the height option, after initialization:
//getter
var height = grid.option( "height" );
//setter
grid.option( "height", '100%-30' );
historyModelType: ObjectDefault: { on: true, allowInvalid: true, checkEditable: true, checkEditableAdd: false }
Defines properties while adding operations in history and while undo/redo. history can be turned on/off with the help of option on.
Invalid cell values are accepted and class editModel.invalidClass is added while undo / redo when allowInvalid option is true.
Cells / rows are checked for editability while undo / redo when checkEditable is true.
Cells are checked for editability while adding rows during undo / redo when checkEditableAdd is true.
Code examples:
Initialize the grid with historyModel option specified.
pq.grid( selector, { historyModel: { on: false ` );
Get or set the historyModel option, after initialization:
//getter
var historyModel = grid.option( "historyModel" );
//setter
grid.option( "historyModel", { allowInvalid: false } );
It provides the hover (mouseenter and mouseleave) behaviour of mouse on grid cells and rows.
It can have value 'row' or 'cell'
Code examples:
Initialize the grid with hoverMode option specified.
pq.grid( selector,{ hoverMode:'cell' });
It determines the behaviour of header cell content which doesn't fit in a single line within the width of the cell. The text in the cells wraps to next line if hwrap = true otherwise the overflowing text becomes hidden and continuation symbol ... is displayed at the end.
(v6.1.0) Localization code of the grid for the strings used at various places like Excel formula intellisense,
Filter menu popup, Loading records, etc.
It can have any value out of 'de', 'en', 'es', 'fr', 'hu', 'it', 'ja', 'kr', 'nl', 'pl', 'pt', 'pt_br', 'ru', 'tr', 'zh', 'zh_TW'.
This option should not be confused with localeFmt
(v10.0.0) Localization code of the grid used by the various localization sensitive format options like column.format, fmtDate\*, fmtNumber\*, etc.
It can be omitted ( default value ) if you need to adapt the formatted values to the user system's locale.
Few examples:
undefined ( locale adaptive to users' locale )
'en-IN' (English, India)
'en-US' (English, United States)
'fr-FR' (French, France)
'de-DE' (German, Germany)
'ja-JP' (Japanese, Japan)
'zh-CN' (Chinese, Simplified)
It sets the maximum height of the grid in pixels (without 'px' suffix) or %.
This option is quite useful when used along with height: 'flex'.
A refresh is required when this option is changed dynamically.
Code examples:
Initialize the grid with maxHeight option specified.
pq.grid( selector,{ maxHeight: 100 });
It sets the maximum width of the grid in pixels (without 'px' suffix) or %.
This option is quite useful when used along with width: 'flex'.
A refresh is required when this option is changed dynamically.
Code examples:
Initialize the grid with maxWidth option specified.
pq.grid( selector,{ maxWidth: 100 });
It displays header menu for show/hide columns and filter columns.
Code examples:
Initialize the grid with menuIcon option specified.
pq.grid( selector,{ menuIcon: true });
It declares the UI of the header menu.
It can also be defined or overridden in individual columns using column.menuUI.
Options
buttons
- Type: Array
- Default:
['clear', 'ok']
- Description: Buttons displayed at the bottom of the filter menu.
singleFilter
- Type: boolean
- Default: (empty)
- Description: Enables a single filter condition instead of the default two filter conditions per column.
tabs
- Type: Array
- Default:
['hideCols', 'filter', 'export']
- Description:
- Tabs to be displayed in the header cell menu.
- Since v9.0.0, the export tab was added for convenient control of the skipExport column property.
gridOptions
- Type: Object
- Default:
{
"autoRow": false,
"copyModel": { "render": true },
"editable": function(ui){ return !ui.rowData.pq_disabled; },
"fillHandle": "",
"filterModel": { "header": true, "on": true },
"hoverMode": "row",
"hwrap": false,
"rowBorders": false,
"rowHt": 24,
"rowHtHead": 26,
"hideVScroll": true,
"scrollModel": { "autoFit": true },
"showTop": false,
"height": 300,
"wrap": false
}
- Description:
Default options for the grid used inside the header menu and filter menu (range condition).
Code examples:
Initialize the grid with menuUI option specified.
pq.grid( selector,{
menuUI: {
buttons: [], //use no button at bottom of filter menu
gridOptions: {
rowHt: 30 //increase height of rows in menu grid.
},
tabs: [ 'filter' ] //display only filter tab in menu.
}
});
mergeCellsType: ArrayDefault: []
it is an array of objects having properties: r1, c1, rc, cc, style, cls. Every object in the array defines a merged cell.
r1 is shorthand for rowIndx which is zero based index of row from top.
c1 is shorthand for colIndx which is zero based index of column from left.
rc & cc define rowspan & colspan for the merged cell.
style is inline css style added to the cell and cls is css class added to the cell.
Call to refreshView( ) is required if mergeCells is changed dynamically.
(v7.4.0) Default value is changed from undefined to [].
Code examples:
Initialize the grid with mergeCells option specified.
pq.grid( selector,{
mergeCells: [
{ r1: 1, c1: 2, rc: 5, cc: 3 },
{ r1: 10, c1: 0, rc: 4, cc: 6 }
]});
Get or set the mergeCells option, after initialization:
//getter
var mergeCells = grid.option( "mergeCells" );
//setter
grid.option( "mergeCells", [
{ r1: 1, c1: 2, rc: 5, cc: 3 },
{ r1: 10, c1: 0, rc: 4, cc: 6 }
]);
Minimum possible width of the grid in pixels.
Code examples:
Initialize the grid with minWidth option specified.
pq.grid( selector,{ minWidth:100 });
Get or set the minWidth option, after initialization:
//getter
var minWidth = grid.option( "minWidth" );
//setter
grid.option( "minWidth", 20 );
(v9.1.0) Skip sticky header when true.
Sticky elements are incompatible with scaled transforms, so sticky headers are automatically omitted
when scaled transforms are used on the grid or its ancestor elements.
Code examples:
Initialize the grid with noStickyHeader option specified.
//disable sticky header
pq.grid( selector, { noStickyHeader: true );
numberCellType: ObjectDefault: { width: 'auto', title: "", format: undefined, resizable: true, menuUI: { tabs: ['hideCols', 'export'] }, minWidth: 50, show: true }
Extra column that displays row numbers starting from 1. You can hide this column by setting numberCell.show to false.
(v9.0.0) Added the menuUI sub-option to display a popup menu on the number column header.
(v11.0.0) The default width is now 'auto', and the format sub-option introduced to support Excel-style number formatting, e.g., "#,###" formats number cells with thousand separators.
Code examples:
Initialize the grid with numberCell option specified.
//disable number cell.
pq.grid( selector, { numberCell: {show: false} } );
Get or set the numberCell option, after initialization:
//getter
var numberCell=grid.option( "numberCell" );
//setter
grid.option( "numberCell", { resizable: true, title: "Sr No" } );
Contains paging properties. Localization strings for the pager can also be passed here.
pageModel sub-options
curPage (integer, default: 0)
Current page number (starts from 1).
format (string)
(v7.4.0) Number formatting for all displayed values, e.g., #,###.
Also applied to the rPPOptions dropdown when options are plain numbers.
layout (array, default: ["first","prev","|","strPage","|","next","last","|","strRpp","|","refresh","|","strDisplay"])
Pager UI template
rPP (integer, default: 10)
Number of results per page.
rPPOptions (array, default: [10, 20, 50, 100])
Options for "results per page" dropdown.
Supports:
- Array of numbers →
[10, 20, 30]
- (v7.4.0) Array of key–value objects →
[{10: 'Ten'}, {20: 'Twenty'}, {50: 'Fifty'}, {100000: 'All'}]
totalPages (integer, default: 0)
Total number of pages.
Auto-calculated for local data.
type (string)
Enables paging for local or remote data.
Possible values:
"local"
"remote"
Paging is disabled when type is null or undefined.
Code examples:
Initialize the grid with pageModel option specified.
//use local paging.
pq.grid( selector, { pageModel: {type: 'local'} } );
Get or set the pageModel option, after initialization:
//getter
var pageModel = grid.option( "pageModel" );
//setter
grid.option( "pageModel", { curPage: 3 } );
pasteModelType: ObjectDefault: { on: true, select: true, allowInvalid: true, type: 'replace' }
Defines properties for pasting rows or cells into the grid.
Sub-options:
on: Toggles the paste feature on/off.
select: If true, selects the rows/cells affected by the paste operation.
allowInvalid: If true, accepts invalid cell values but marks them with the class defined by editModel.invalidClass.
type: Determines the paste action:
replace: Replaces the existing selection.
append: Appends pasted data to the selected rows/cells.
prepend: Prepends pasted data to the selected rows/cells.
Code examples:
Initialize the grid with pasteModel option specified.
pq.grid( selector, {pasteModel: { on: false } } );
Get or set the pasteModel option, after initialization:
//getter
var pasteModel = grid.option( "pasteModel" );
//setter
grid.option( "pasteModel.allowInvalid", false );
An array of objects, where each object defines a single floating picture with the following properties:
{
name?: string // name of picture
src: string // url or base64 encoding of picture
from: [number, number, number, number] // [colIndx, horizontal offset, rowIndx, vertical offset ]
to?: [number, number, number, number] // Optional endpoint coordinates
cx?: number // width
cy?: number // height
}
Pictures loaded from the same domain are exportable to Excel. Please check Pic() and Range().pic() methods to work with floating pictures during runtime.
Code examples:
Initialize the grid with pics option specified.
pq.grid( selector,{
pics: [
{ name: "pic.png", src: "data:image/png,....", from: [2,1,2,1] },
{ src: "/content/pqgrid.png", from: [1,1,1,1] }
]});
Get or set the pics option, after initialization:
//getter
var pics = grid.option( "pics" );
It determines the time interval in milliseconds between the refresh of view of grid and first call to column.postRender.
column.postRender is called asynchronously when this option is >= 0.
column.postRender is called synchronously when this option is -1.
column.postRender is not called when this option is undefined.
New in v6.1.0
Background: When grid is initialized it makes a deep copy of all options in the initialization object except arrays like dataModel.data, colModel, etc which are copied by reference only.
reactive option:
- makes the grid listen and react to any change in initialization options of grid, data in grid and colModel. So when any external change is made in them, grid reacts by making corresponding change in itself.
- Conversely it makes changes in initialization options when any change is made in the grid internally ( usually by user interaction with the grid )
This data flow between grid and initialization options facilitates 2 way data binding which can be leveraged for seamless integration of grid with modern javascript frameworks like Angular, React, Vue, etc.
Know how: This option detects changes by
- using getters and setters for object properties
- listening to Array manipulation methods like push, splice, shift, unshift, pop, sort for arrays.
As a side note it works quite similar to reactivity of Vue framework.
Limitations:
- Object properties for which reactiveness is sought need to be declared upfront in the initialization object.
- Only above mentioned array manipulation methods should be used to manipulate arrays. For example array[ i ] = value would go undetected.
- It works only for the options which are most commonly mutated after initialization.
The grid can be resized horizontally and vertically if this is set to true.
refreshCompareByType: stringDefault: "value"
(v8.4.0) Grid finds and refreshes only the affected or dependent cells in the viewport after editing a cell.
This option defines the criteria by which grid finds the affected cells in beforementioned case.
It has 3 possible values:
"value": Grid compares all cell values in viewport before and after edit of cell. This is the default value and is suitable for most cases.
"render": Grid compares the final rendering of all cells in viewport before and after edit of cell. It's more accurate than "value" but slower and rarely useful.
"": It disables the comparison functionality.
roundCornersType: BooleanDefault: true
Display of rounded corners at all 4 corners of the grid.
rowBordersType: BooleanDefault: true
Draws horizontal borders around all the rows.
Set constant initial height of all rows in grid.
- (v11.1.0):
rowHt is considered in css em units if < 10, px otherwise.
- Assign
pq_ht property to rowData to set different heights for different rows.
Set constant initial height of all header rows in grid.
- (v11.1.0):
rowHt is considered in css em units if < 10, px otherwise.
Set constant initial height of all footer rows in grid.
- (v11.1.0):
rowHt is considered in css em units if < 10, px otherwise.
- Assign
pq_ht property to rowData to set different heights for different rows.
rowInit callback is called by the grid for every row in the viewport when whole view is refreshed. It's called for the affected row when refreshRow is called.
It can be used to inject classes, styles or attributes to rows or cells dynamically based on the current data in row i.e., rowData.
Can return an object having cls, style & attr properties which are injected in the current row.
(v7.0.0) style returned by rowInit is exported as row style to Excel export
Code examples:
Initialize the grid with rowInit option specified.
pq.grid( selector, {rowInit: function( ui ){
if ( some condition based on ui.rowData ){
return { cls: 'green', style: 'font-size:18px;', attr: 'some HTML attribute for the row' };
}
`);
rowResizeType: BooleanDefault: true
(v7.4.0) Rows can be resized by dragging the number cells bottom edge.
(v9.0.0) This option affects the display of grouped columns in header.
Columns are merged vertically when this option is true. See the examples for visual
demonstration.
(v8.0.0) This option defines common row properties to avoid repetition of properties in the rows in keeping with the principle of DRY (don't repeat yourself).
Properties defined in this option are:
- Deep cloned ( in case of nested properties ) and copied to all rows.
- Not copied when a row contains defined value for that property, so a property can be overriden in individual rows.
scrollModelType: ObjectDefault: { autoFit: false, timeout: 300, bigSB: false }
When autoFit is true, Grid changes the width of the columns to fit them all into the viewport without scrolling. Any resize/change in the grid width leads to proportional change in width of columns.
scrollStop event is fired when scrolling is stopped / paused for more than timeout milliseconds.
(v11.0.0) By default, scrollbars span only the unfrozen panes of the grid. When bigSB (big scrollbar) is set to true, the scrollbar extends across both frozen and unfrozen panes.
Code examples:
Initialize the grid with scrollModel option specified.
pq.grid( selector,{ scrollModel:{ autoFit: true });
Selection related options:
all (boolean)
Controls selection when Ctrl + A is pressed.
- When
true: selects all pages
- When
false/undefined: selects only the current page
column (boolean, default: true)
Allows column selection by clicking column headers.
Enabled by default since v7.0.0.
mode (string, default: 'block')
Determines selection mode:
"single" → select only one row/cell
"block" → select multiple rows/cells
native (boolean)
Enables native browser selection for the entire grid.
For enabling it only in specific areas, apply the class pq-native-select.
row (boolean, default: true)
Selects all cells in the row by clicking on number cells.
toggle (boolean)
Applies only to row selection.
type (string, default: 'cell')
UI selection type:
"cell" → cell selection
"row" → row selection
null → disable UI selection
For both row + cell selection: use cell selection + checkbox-based row selection.
Code examples:
Initialize the grid with selectionModel option specified.
pq.grid( selector, {selectionModel: { type: 'cell', mode: 'block'} } );
Get or set the selectionModel option, after initialization:
//getter
var selectionModel=grid.option( "selectionModel" );
//setter
grid.option( "selectionModel", {type: 'row', mode: 'single'} );
showBottomType: BooleanDefault: true
Governs display of bottom section of the grid.
Frozen rows at bottom and Paging toolbar are displayed in the bottom section.
Code examples:
Initialize the grid with showBottom option specified.
pq.grid( selector, { showBottom : true } );
Get or set the showBottom option, after initialization:
//getter
var showBottom = grid.option( "showBottom" );
//setter
grid.option( "showBottom", false );
showHeaderType: BooleanDefault: true
It determines display of the header of the columns.
Code examples:
Initialize the grid with showHeader option specified.
pq.grid( selector, {showHeader: false} );
Get or set the showHeader option, after initialization:
//getter
var showHeader = grid.option( "showHeader" );
//setter
grid.option( "showHeader", false );
showTitleType: BooleanDefault: true
Governs display of title in the top section(above the column headers) of the grid.
Code examples:
Initialize the grid with showTitle option specified.
pq.grid( selector, { showTitle : true } );
Get or set the showTitle option, after initialization:
//getter
var showTitle = grid.option( "showTitle" );
//setter
grid.option( "showTitle", false );
Governs display of top section (above the column headers) of the grid.
Code examples:
Initialize the grid with showTop option specified.
pq.grid( selector, { showTop : true } );
Get or set the showTop option, after initialization:
//getter
var showTop=grid.option( "showTop" );
//setter
grid.option( "showTop", false );
showToolbarType: BooleanDefault: true
Governs display of toolbar within the top region(above the column headers) of the grid.
Code examples:
Initialize the grid with showToolbar option specified.
pq.grid( selector, { showToolbar : true } );
Get or set the showToolbar option, after initialization:
//getter
var showToolbar=grid.option( "showToolbar" );
//setter
grid.option( "showToolbar", false );
(v9.1.0) Turn off spreadsheet functions when true. Useful for performance gains with large no of records.
Code examples:
Initialize the grid with skipSSFn option specified.
pq.grid( selector, { skipSSFn : true } );
Get or set the skipSSFn option, after initialization:
//getter
var skipSSFn = grid.option( "skipSSFn" );
sortModelType: ObjectDefault: { cancel: true, ignoreCase: false, multiKey: 'shiftKey', number: true, on: true, single: true, sorter: [ ], space: false, type: 'local', wholeCell: undefined }
Defines the properties and behavior for column sorting.
Sub-options
cancel
- When true, clicking a header cycles through: ascending → descending → unsorted.
- When false, cycles through only: ascending → descending.
- Applies to single-column sorting and the first column in multi-column sorting.
ignoreCase
- Set to true for case-insensitive sorting of string columns.
multiKey
- Modifier key used to enable multi-column sorting when clicking additional header cells.
- Set to null (and set
single: false) to allow multi-column sorting without a modifier key.
number
- In multi-column sorting, displays a numeric priority (starting from 1) next to each sorted column’s header title.
on
- Boolean. Set to false to disable sorting for all columns.
single
- Controls whether sorting is single-column or multi-column.
- true → only one column can be sorted at a time (sorter array has 1 object).
- false → multiple columns can be sorted simultaneously (sorter array has multiple objects).
sorter
- An array of objects:
{ dataIndx: <column>, dir: "up" | "down" }.
- Specifies the current sorting state for each sorted column.
space
- Reserves space in header cells (for sort icon + number indicator) even for non-sorted columns.
- Primarily useful for flex layouts.
type
- Determines where sorting occurs.
- Possible values: "local", "remote".
wholeCell
- Makes the entire header cell clickable for sorting (instead of just the title).
- Requires
selectionModel.column = false.
Note: Use the sort method to dynamically update sortModel options.
Code examples:
Initialize the grid with sortModel option specified.
pq.grid( selector,{
sortModel: {
cancel: false,
type: "local",
sorter:[ { dataIndx: "products", dir: "up" } ]
}
});
Get or set the sortModel option, after initialization:
//getter
var sortModel = grid.option( "sortModel" );
stateColKeysType: objectDefault: { width: 1, filter: [ 'crules', 'mode' ], hidden: 1 }
Specifies which column properties are preserved by saveState method.
To include additional properties, set their value to 1; to skip existing properties, set the value to 0.
For nested properties (e.g., filter), specify the required sub-options as an array.
Code examples:
Initialize the grid with stateColKeys option specified.
//save column title and skip column width.
pq.grid( selector, { stateColKeys : { title: 1, width: 0} } );
stateKeysType: objectDefault: {
height: 1,
width: 1,
freezeRows: 1,
freezeCols: 1,
groupModel:[ 'dataIndx', 'collapsed', 'grandSummary' ],
pageModel: [ 'curPage', 'rPP' ],
sortModel: [ 'sorter' ]
}
Specifies which grid properties are preserved by saveState method.
To include additional properties, set their value to 1; to skip existing properties, set the value to 0.
For nested properties (e.g., groupModel, pageModel), specify the required sub-options as an array.
Support for treeModel added.
Code examples:
Initialize the grid with stateKeys option specified.
//skip freezeCols property.
pq.grid( selector, { stateKeys : { freezeCols: 0} } );
//include open / close state of nodes from treegrid.
pq.grid( selector, { stateKeys : { treeModel: ['nodeClose']} } );
stringifyType: BooleanDefault: true
Serialize the remote sort and filter requests using JSON.stringify.
It works fine for ASP.NET (MVC) but some environments (e.g. PHP) can't handle
stringified requests, it can be turned off for them by setting it to false.
Code examples:
Initialize the grid with stringify option specified.
pq.grid( selector, { stringify : false } );
stripeRowsType: BooleanDefault: true
Determines highlighting of odd or alternate rows in the grid.
Currently this option is supported only for custom themes e.g. 'Office' theme.
Highlighting of odd rows can be achieved in other themes using css rules.
Code examples:
Initialize the grid with stripeRows option specified.
pq.grid( selector, { stripeRows : false } );
Get or set the stripeRows option, after initialization:
//getter
var stripeRows=grid.option( "stripeRows" );
//setter
grid.option( "stripeRows", true );
An array of any number of rows in format similar to the main data in grid. When defined, it creates fixed rows at the bottom of grid with row data taken from this option. It can be get and set at runtime after initialization like any other option.
Code examples:
Initialize the grid with summaryData option specified.
pq.grid( selector,{
summaryData : [
{rank: 10, company: 'x', profit: 100, loss: 50 },
{rank: 12, company: 'y', profit: 200, loss: 60 }
]
});
(v8.1.0) By default, summary of grouped rows or in plain grid is displayed at bottom of table body.
Summary is displayed on top of table body when this option is true.
This option can't be changed after initialization of grid.
Code examples:
Initialize the grid with summaryOnTop option specified.
pq.grid( selector, {
summaryOnTop : true
});
summaryOptionsType: ObjectDefault: { number: "avg,max,min,stdev,stdevp,sum",
date: "count,max,min",
string: "count" }
Aggregate options for Pivot toolPanel aggregate pane and summary editor corresponding to data types of columns. e.g., for date datatype columns, "count", "max" and "min" options are available.
Any inbuilt or custom aggregate can be included or removed by updating this option e.g., count can be added while stdev, stdevp, sum can be removed for numbers as below:
summaryOptions: {
number: "avg,min,max,count"
}
summaryTitleType: ObjectDefault: { avg: "Avg: {0}",
count: 'Count: {0}',
max: "Max: {0}",
min: "Min: {0}",
sum: "Sum: {0}" }
Titles for summary cells corresponding to different aggregates.
Titles can be strings or callback functions.
Titles can be added for custom aggregates in summary cells by changing this object.
(v8.1.0) Configures properties for displaying a tabs UI similar to a spreadsheet application. The UI is enabled when the tabs sub-option has a defined value (even an empty array).
Type Definition: tab
Sub-options:
activeId: Index of the currently active tab
newTab: Callback to return a new tab object
noAdd: Disables adding new tabs from the UI
noSortable: Disables sorting tabs from the UI
tabs: Array of initial tab objects
Code examples:
Initialize the grid with tabModel option specified.
//turn on the tabs UI
pq.grid( selector, {tabModel: { tabs: [] } } );
The definition for a single tab object used within the tabModel.tabs array.
Properties:
extraRows?: number // extra rows
extraCols?: number // extra columns
gridOptions?: pq.gridT.options | function // grid options used during initialization
hidden?: boolean // initially hidden
noClose?: boolean // tab can't be closed
noRename?: boolean // tab can't be renamed
name?: string // name of tab
sheet?: worksheet // worksheet structure
tabModel.activeIdType: numberDefault: 0
The index of the active tab, starting from 0.
tabModel.newTabType: functionDefault:
function(){
return {
sheet: {},
extraRows: 20,
extraCols: 10
}
}
A callback function that is executed whenever a new tab is added. It must return a valid tab object.
If true, new tabs cannot be added through the UI.
If true, tabs cannot be reordered (sorted) from the UI.
An array of initial tab objects. Defining this option (even as an empty array) turns on the tabs UI.
Code examples:
Initialize the grid with title option specified.
pq.grid( selector, {title:'Shipping Details'} );
Get or set the title option, after initialization:
//getter
var title=grid.option( "title" );
//setter
grid.option( "title", "Order Details" );
Defines the toolbar UI for the grid. The toolbar is an Object containing the following properties:
cls: CSS class for the toolbar container.
style: CSS style for the toolbar container.
items: An array of control objects defining the contents of the toolbar.
toolbar.item Properties:
attr: Assigns a general attribute to the control.
attrFile **: Assigns an attribute specifically to a file control.
Example: attrFile: 'accept=".xlsx"'
cls: Assigns a CSS class to the control.
icon: Defines the class of a jQuery UI icon or a custom 16×16 icon.
Applicable to button and file controls (v7.2).
init (v7.1.0): Callback used to initialize a custom control (e.g., datepicker, colorpicker).
Receives the DOM element of the control as an argument.
label: Sets the label text. Applicable to button, checkbox, textbox, and textarea controls.
listeners: An array of event listeners for the control.
listener:
- As an object: Adds a single event listener where the key is the DOM event name and the value is the callback.
Example: listener: { 'click': function(){ } }
Supports non-DOM event "timeout", which triggers the callback asynchronously after the interval defined in filterModel.timeout since the last keyup or change event.
- As a callback: Adds a single event listener without specifying the event type (inferred from the control type).
Example: For select, input, or textarea, the change event is used automatically.
options: Defines options for the control.
- For a select list: Can be an array of options or a callback returning options.
- For a button: Options are passed as an object during initialization.
Example: options: { text: false, showLabel: false } creates an icon-only button.
See the jQuery UI button API for the full list of options.
style: Applies CSS styles to the control.
For non-button controls with labels, the style is applied to the label instead of the control.
type: Specifies the type of control.
Supported values: checkbox, color, textbox, textarea, file, button, select, separator, an HTML string, or a callback returning an HTML string.
(v11.x): Additional built-in types include
align
bgColor: Background color
bold
border
cut
copy
fgColor: Foreground color
fontSize
fontFamily
fullscreen
import: Import csv or xlsx file
italic
paste
pic: Floating pictures
picCell: Cell pictures
redo
underline
undo
valign
wrap
value Sets the initial or current value of the control.
Context: The context (this) of callbacks/listeners is the grid instance.
The control reference is event.target in listeners.
Code examples:
Initialize the grid with toolbar option specified.
var toolbar = {
cls: 'pq-toolbar-crud',
items: [
{
type: 'button',
label: 'Add',
icon: 'ui-icon-plus',
listener: function(){ }
},
{
type: 'checkbox',
label: 'Merge cells',
value: true, //checked initially.
listener: function(){ }
},
{
//inbuilt type
type: 'cut'
},
{
//inbuilt type
type: 'copy',
//any property of inbuilt type can be overridden.
listener: function(){
this.copy({header: true});
}
},
{ type: 'button', label: 'Delete', icon: 'ui-icon-minus', listener: deletehandler }
]
};
pq.grid( selector, { toolbar: toolbar } );
Get or set the toolbar option, after initialization:
//getter
var toolbar = grid.option( "toolbar" );
//setter/manipulation examples:
grid.option( "toolbar", new_toolbar_object );
grid.option( "toolbar.items", new_toolbar_items_array );
grid.option( "toolbar.items").push( new_toolbar_item_object );
// Must be called after all toolbar changes:
grid.refreshToolbar();
It provides GUI within the grid for managing pivoting, row grouping, and aggregate columns.
Sub-options:
disablePivotChkBox (boolean)
Disable the pivot check box displayed beside Pivot mode.
hideAggPane (boolean)
Hides the Aggregate pane.
hideColPane (boolean)
Controls visibility of the pivot pane.
- When
true: pivot pane is always hidden.
- When
false: pivot pane is hidden when pivot mode (groupModel.pivot) is off, and visible when pivot mode is on.
hideGroupChkBox (boolean)
Hides the grouping check box displayed beside Row grouping title.
hidePivotChkBox (boolean)
Hides the pivot checkbox used to toggle pivot mode (groupModel.pivot).
hideRowPane (boolean)
Hides the Row grouping pane.
show (boolean)
Shows the toolPanel initially. Use ToolPanel() methods to show/hide after initialization.
Code examples:
Initialize the grid with toolPanel option specified.
//show toolPanel initially.
pq.grid( selector, {toolPanel: { show: true } } );
trackModelType: ObjectDefault: { on: false, dirtyClass: 'pq-cell-dirty' }
Sets tracking properties for inline add, update, and delete operations.
When these are set, the following transactional methods become available:
isDirty() – Checks if there are any unsaved changes.
getChanges() – Retrieves added, updated, and deleted rows.
commit() – Commits all tracked changes.
rollback() – Reverts all tracked changes.
Code examples:
Initialize the grid with trackModel option specified.
pq.grid( selector,{ trackModel : { on: true } });
Get or set the trackModel option, after initialization:
//getter
var trackModel = grid.option( "trackModel" );
//setter
grid.option( "trackModel", { on : false } );
treeModelType: ObjectDefault: {childstr:'children', id: id, indent: 18, parentId: 'parentId', cbId: 'pq_tree_cb' }
Treegrid groups rows based on a common parent and displays them hierarchically.
treeModel allows configuration of treegrid behavior.
Use Tree().option() to set options after initialization.
Also see Tree() method.
childstr (string, default: 'children')
- Field name containing nested children.
- Prefix with
pq_ (e.g., pq_children) to exclude nested nodes from getChanges() during batch editing.
dataIndx (string | integer, required)
- Column used to display tree nodes.
- Mandatory for treegrid.
filterLockSummary (boolean)
- (v7.7.0) Prevents summary values from changing during filtering.
- Works only with
filterInTitleRow.
filterShowChildren (boolean)
- (v7.7.0) Shows all children when the parent matches a filter.
format (string)
- Possible values:
nested, flat.
- Auto-detected from data.
- Nested data example:
var data = [{
id: 1,
name: "C",
size: "",
date: "05/13/2008",
children: [{
id: 2,
name: "Program Files",
size: "9047",
date: "03/06/2015",
children: [
{ id: 21, name: "Apache", size: "", date: "01/16/2010" }
]
}]
}];
- Flat data example:
var data = [
{ id: 1, name: "C", size: "", date: "05/13/2008" },
{ id: 2, name: "Program Files", size: "9047", date: "03/26/2015", parentId: 1 },
{ id: 21, name: "Apache", size: "", date: "01/16/2010", parentId: 2 }
];
hideLines (boolean)
- (v9.1.0) Hide hierarchy connector lines.
historyAdd (boolean)
- (v7.4.0) Controls history for
addNodes. Defaults to historyModel.on.
historyDelete (boolean)
- (v7.4.0) Controls history for
deleteNodes. Defaults to historyModel.on.
historyMove (boolean)
- (v7.4.0) Controls history for
moveNodes. Not added to history by default.
iconCollapse (array, default: ['ui-icon-triangle-1-se','ui-icon-triangle-1-e'])
iconFolder (array, default: ['ui-icon-folder-open','ui-icon-folder-collapsed'])
iconFile (string, default: 'ui-icon-document')
icons (boolean)
- Show icons beside all nodes.
id (string, default 'id')
- Field storing unique row identifier.
- Required for nested or flat formats.
indent (integer, default 1.5)
- per-level indent = indent × level; (v11.1.0) values ≤ 3 are treated as em, values > 3 as px.
parentId (string, default 'parentId')
- Field storing parent row ID (flat data).
leafIfEmpty (boolean)
- (v7.4.0) Converts empty folders (after add/delete/move/undo/redo) into leaf nodes.
nodeClose (object)
render (function)
- Custom rendering beside the icon/checkbox.
- Similar to
column.renderLabel (which has higher precedence).
- Can return text, HTML, or an object:
attr
cls
iconCls
style
text
- Example:
render: function(ui){
var iconCls, cd = ui.cellData, cls, attr, text, style;
if(cd == "some value"){
iconCls = 'ui-icon-print';
cls = 'red';
attr = "title='This is title'";
}
else if(cd.indexOf("some text") >= 0){
iconCls = 'ui-icon-home';
style = "text-decoration:underline;background:yellow;font-style:italic;";
text = "Home";
}
else if(cd == "some other value"){
return "<b>Hello there</b>";
}
return { attr, cls, iconCls, style, text };
}
summary (boolean)
- Show summary row for children.
summaryInTitleRow (boolean)
- (v7.7.0) Show summary within parent row.
- Disable
treeModel.summary when using this.
Code examples:
Initialize the grid with treeModel option specified.
pq.grid( selector,{ treeModel : { dataIndx: 'name' } });
By default the events generated by the grid are not emitted to DOM nodes.
It can be turned on by setting this option to true.
Code examples:
Initialize the grid with trigger option specified.
//turn trigger on
pq.grid( selector, { trigger: true } );
Get or set the trigger option, after initialization:
//getter
var trigger = grid.option( "trigger" );
validationType: ObjectDefault: { icon: 'ui-icon-alert', cls: 'ui-state-error', style: 'padding:3px 10px;' }
It provides the tooltip properties used in cell validations.
icon, cls and style are added to the tooltip.
Note that validation sub options can be overridden in the individual column validations
( column.validations[ ] ).
Code examples:
Initialize the grid with validation option specified.
//no display of icon in the validation tooltip.
pq.grid( selector, {validation: { icon: '' } } );
Get or set the validation option, after initialization:
//getter
var validation = grid.option( "validation" );
//setter
var validation = {
icon: 'ui-icon-info',
cls: 'ui-state-default'
};
grid.option( "validation", validation );
(v8.1.0) Virtual rendering w.r.t browser window for rows i.e.,
rows which lie within intersection of browser viewport and grid viewport at any instant are rendered.
Code examples:
Initialize the grid with virtualWin option specified.
pq.grid( selector, {virtualWin: true } );
(v7.5.0) Virtual rendering along x axis i.e. columns can be disabled by setting this option to false.
Virtual rendering is enabled by default otherwise.
Code examples:
Initialize the grid with virtualX option specified.
pq.grid( selector, {virtualX: false } );
(v7.5.0) Virtual rendering along y axis i.e. rows can be disabled by setting this option to false.
Virtual rendering is enabled by default otherwise.
Code examples:
Initialize the grid with virtualY option specified.
pq.grid( selector, {virtualY: false } );
warningType: ObjectDefault: { icon: 'ui-icon-info', cls: '', style: 'padding:3px 10px;' }
It provides the tooltip properties used in cell warnings.
icon, cls and style are added to the tooltip.
Note that warning sub options can be overridden in the individual column warnings
( column.validations[ ] ).
Code examples:
Initialize the grid with warning option specified.
//no display of icon in the warning tooltip.
pq.grid( selector, { warning: { icon: '' } } );
Get or set the warning option, after initialization:
//getter
var warning = grid.option( "warning" );
//setter
var warning = {
icon: 'ui-icon-info',
cls: 'ui-state-default'
};
grid.option( "warning", warning );
Width of the grid in number of pixels (without 'px' suffix) i.e., 150, percent (%) i.e. '80%',
combination of % and px i.e. '100%-20' or '50%+10', auto or flex.
When % format is used, width is calculated relative to the immediate parent of grid
unless dimsRelativeTo is specified.
The grid width becomes sum total of all the columns when width is flex.
Note that refresh method should be called when width is changed dynamically through setter.
Code examples:
Initialize the grid with width option specified.
pq.grid( selector, { width: 500} );
Get or set the width option, after initialization:
//getter
var width=grid.option( "width" );
//setter
grid.option( "width", 500 );
It determines the behaviour of cell content which doesn't fit in a single line within the width of the cell. The text in the cells wraps to next line if wrap = true otherwise the overflowing text becomes hidden and continuation symbol ... is displayed at the end.
Code examples:
Initialize the grid with wrap option specified.
pq.grid( selector, {wrap:true} );
Get or set the wrap option, after initialization:
//getter
var wrap=grid.option( "wrap" );
//setter
grid.option( "wrap", true );
addClass( { rowData, rowIndx, dataIndx, cls, refresh } )
Adds one or more classes to a row or cell.
Either rowData or rowIndx can be passed.
Arguments
rowData (Object | Array)
Reference to a 1-dimensional array or object representing row data.
rowIndx (number)
Zero-based index of the row.
dataIndx (number | string)
Key name or index in rowData.
cls (string)
One or more CSS class names (space-separated).
refresh (boolean)
Optional. Default is true.
Code examples:
Invoke the method:
//Add classes 'pq-delete' & 'pq-edit' to 3rd row.
grid.addClass( {rowIndx: 2, cls: 'pq-delete pq-edit'} );
//Add a class 'pq-delete' to 'profits' field in 3rd row
grid.addClass( {rowIndx: 2, dataIndx: 'profits', cls: 'pq-delete'} );
addClassHead( { ri, colIndx, cls } )
Adds one or more classes to any head cell including filter row cells.
Arguments
ri (number)
Zero-based index of the header row.
cls (string)
One or more CSS class names (space-separated).
colIndx (number)
Zero-based index of the column.
Code examples:
Invoke the method:
//Add class to a cell in header.
grid.addClassHead( {ri: 0, colIndx: 4, cls: 'mycls'} );
//Add a class to a cell in header filter row
grid.addClassHead( {ri: 1, colIndx: 3, cls: 'somecls'} );
addNodes( nodes: any[ ], rowIndx?: number )
Add or insert new nodes/rows in the grid.
New rows are inserted at passed rowIndx, they are appended when rowIndx is not passed.
It works similar to addRow except that ui.source value is "addNodes" in the events fired during the process.
Arguments
Code examples:
Invoke the method:
//Insert 2 empty rows at rowIndx: 10
grid.addNodes([{}, {}], 10);
addRow( { newRow, rowIndx, rowList, track, source, history, checkEditable, refresh } )Returns: Integer
Appends one or more rows to the local data and returns the rowIndx of the added row.
If rowIndx is provided, the row(s) are inserted at the specified position instead of appended.
Arguments
rowIndx (Integer)
Zero-based index of the row.
newRow (Object)
Object containing the modified data for single row.
v11.0.0: Rich objects or normal cells with attributes, properties and style can be passed instead of primitive values in an object format.
{ val, attr, prop, style }
rowList (Array)
Array of objects in the form { rowIndx, newRow }.
Used for multiple rows.
checkEditable (Boolean)
Optional. Default is true.
Checks the editability of the row and its cells.
history (Boolean)
Optional. Default is historyModel.on.
Determines whether this operation is added to the history.
refresh (Boolean)
Optional. Default is true.
If false, the view is not refreshed.
source (String)
Optional. Default is 'update'.
Value is available in the beforeValidate and change event
track (Boolean)
Optional. Default is trackModel.on.
beforeValidate and change events are fired by this method.
Code examples:
Invoke the method:
//Append a new row.
grid.addRow(
{ newRow: {id: 20, product: 'Colgate' } }
);
//Insert an empty row at rowIndx : 3
grid.addRow(
{ newRow: {}, rowIndx: 3 }
);
//Insert multiple rows at once.
grid.addRow( {
rowList:[
{ newRow: {}, rowIndx: 3 },
{ newRow: { product: 'Apple' }, rowIndx: 5 }
]
});
//v11.0.0: insert a row having rich objects and / or rich styles
grid1.addRow({
rowIndx: 1,
newRow: {
//rich object cell with style
ProductName: {
val: 'ParamQuery API',
prop: {
inst: 'Link', //this makes it rich object.
link: '../api'
},
style: {
background: "#ff9999"
}
},
//ordinary cell with attr, prop & style
UnitPrice: {
val: 30,
attr:{
title: "This is a rich cell with style and attr"
},
prop:{
format: '#0.00',
align: 'center'
},
style: {
'border-top': "3px dotted #ff9999",
'font-style': "italic"
}
}
}
})
attr( { rowData, rowIndx, dataIndx, attr } )Returns: Object
Get the value of an attribute for a row or cell or set one or more attributes for a row or cell.
Either rowData or rowIndx can be passed.
Arguments
rowData (Object | Array)
Reference to a 1-dimensional array or object representing row data.
rowIndx (number)
Zero-based index of the row.
dataIndx (number | string)
Key name or index in rowData.
attr (Object)
Key–value pairs of attribute(s).
Code examples:
Invoke the method:
//Add a row title.
grid.attr( {rowIndx: 2, attr: { title: 'Row title' } );
//get style attribute of 3rd row.
var style = grid.attr( {rowIndx: 2, attr: 'style' } ).attr;
//Add a cell title
grid.attr(
{rowIndx: 2, dataIndx: 'profits', attr: { title: 'cell title' } }
);
Returns the checkbox column instance, allowing further checkbox-related manipulation methods to be called.
Arguments
dataIndx (string)
Field name of the column that displays the checkbox UI.
Notes
This is used only for non-heirarchical checkboxes.
For hierarchical checkboxes like those in treegrid and row grouping, use checkbox-related methods of grid.Tree() and grid.Group().
The following events are fired when checkAll, checkNodes, unCheckAll, unCheckNodes are called:
- ⚡
beforeCheck
- ⚡
beforeValidate
- ⚡
change
- ⚡
check
Individual checkboxes can also be checked/unchecked with updateRow() method of grid.
In this case, the following events are fired:
- ⚡
beforeValidate
- ⚡
change
- ⚡
check
Methods (also available in Group() and Tree() for hierarchy checkboxes)
checkAll
checkNodes (nodes: array)
- Check the specified nodes.
getCheckedNodes (all?: boolean)
- Returns an array of checked rows.
- Includes checked rows from un-filtered data when
all is true.
isHeadChecked
- Returns
true, false, or null (indeterminate state).
unCheckAll
unCheckNodes (nodes: array)
- Uncheck the specified nodes.
Code examples:
Invoke the method:
grid.Checkbox( 'ShipCountry' ).checkAll();
Collapse the grid to display only the title bar of the grid.
Code examples:
Invoke the method:
grid.collapse();
Returns the columns instance used to manipulate columns:
Note
- Both
gcm and cm used in the API ( instance methods ) are arrays
- gcm is the whole colModel that includes parent grouped columns
- cm is colModel fragment array, normally used for children columns.
Instance methods
add(columns: Array, ci?: number, cm?: colModel, source?: string)
- Inserts one or more adjacent columns into the
colModel at the given index ci.
- Adds parent-level or nested-level columns depending on
cm.
- Appends new columns when
ci is null or undefined.
- Parent-level columns are added when
cm is not provided.
source helps identify the origin of the method call in events.
- ⚡
beforeColAdd and colAdd events.
alter(callback: () => any)
- Applies property changes to any column(s) within the callback.
each(callback: (column) => any, cm?: colModel)
- Calls the callback on each column recursively.
- Operates on
gcm by default, or on cm when provided.
find(callback: (column) => boolean, cm?: colModel)
- Recursively searches for a column in
gcm (default) or in cm.
- Return
true inside the callback to indicate the column was found.
- Returns the matching column object.
hide(ui: { diHide?: Array, diShow?: Array })
- Hides or shows columns using arrays of
dataIndx.
- ⚡
beforeHideCols and hideCols events.
move(num: number, fromindx: number, toindx: number, fromParent?: column, toParent?: column, source?: string)
- Moves
num columns from fromParent at fromindx to toParent at toindx.
- Parent arguments are optional for top-level columns.
toindx is computed before removal of dragged columns.
- Returns the moved columns array.
source identifies origin of method call.
- ⚡
beforeColMove and colMove events.
reduce(callback: (column) => object, cm?: colModel)
- Recursively reduces the column model into a new
colModel array.
remove(num: number, ci: number, cm?: colModel, source?: string)
- Removes one or more adjacent columns from index
ci.
- Removes parent-level columns when
cm is not provided.
source identifies origin of method call.
- ⚡
beforeColRemove and colRemove events.
reverse()
- Recursively reverses the
colModel array.
Code examples:
Invoke the method:
//collapse the column having known title.
grid.Columns().alter(function(){
Cols.find(function(column){
return (column.title=="Revenues ($ millions)");
}).collapsible = {on: true};
})
Accepts or commits the add, edit and delete operations done after turning on tracking.
grid.History().reset() should be called after commiting all type of operations to maintain the history state.
Arguments
type (string)
Optional. limits the commit operation. Possible values are add, update or delete.
rows (array)
Optional. Array of rows used to limit the commit to matching rows only.
Used only along with type argument
Also helps when updating primary keys of added records from the server,
and in controlling updated/deleted records returned by the server.
When type = add and rows is provided, commit updates the primary key (recIndx) of the matching records in the grid using values from rows.
Code examples:
Invoke the method:
//commit all added, updated and deleted records.
grid.commit();
//commit all updated records.
grid.commit( { type: 'update' } );
//commit updated records with matching rows only.
grid.commit( { type: 'update', rows: rows } );
//commit added records only and update the primary key of added records from rows.
grid.commit( { type: 'add', rows: rows } );
(v9.0.0) Returns context menu instance for manipulation of the context menu.
Instance methods
showMenu(of: any, ui: { at: string, my: string, type: string})
Displays the context menu positioned relative to the of element/event.
Parameters:
of (any): Element, jQuery object, or Event used as the anchor for positioning the context menu.
ui (object):
at (string): Same as jQuery UI position.at.
my (string): Same as jQuery UI position.my.
type (string): Identifies which contextMenu items to use.
For example, type = 'toolbar' uses toolbarItems from the contextMenu definition.
Code examples:
Invoke the method:
grid.Context().showMenu( element, {
type: 'custom',
my: "right top",
at: "right bottom"
})
copy(obj?: {
dest?: objRange
render?: boolean
header?: bolean
})Returns: Promise
It copies selected cells / rows in a grid to the clipboard.
Content is immediately copied to the destination range rather than clipboard when dest parameter is passed. Rendered values are copied when render is true. Header values in same column as selections are also copied along with content when header is true.
render and header are applicable only for clipboard based operations.
Code examples:
Invoke the method:
//copy selections.
await grid.copy( );
cut(obj?: {
dest?: objRange
render?: boolean
header?: bolean
})Returns: Promise
It cuts selected cells / rows in a grid for the clipboard. The copied conent is removed from the source when it's pasted somewhere in the same document.
Content is immediately moved to the destination range rather than clipboard when dest parameter is passed. Rendered values are copied when render is true. Header values in same column as selections are also copied along with content when header is true.
render and header are applicable only for clipboard based operations.
Code examples:
Invoke the method:
//cut selections.
await grid.cut( );
data( obj: { rowData, rowIndx, dataIndx, data } )Returns: Object
Store or access arbitrary data ( i.e., array, object, string, etc ) associated with a specified row or cell. It acts as a private or meta data store of a cell or row and is different from normal grid row ( i.e., rowData ) and cell data ( i.e., rowData[ dataIndx ]). This method returns the entire data of cell or row when data argument is not passed to it and returns partial data when key name of data is passed to it. Either rowData or rowIndx can be passed to this method. Meta data associated with this API can also be stored or manipulated as part of grid JSON data ( i.e., dataModel.data ) as rowData\[ 'pq\_rowdata' \] or rowData\[ 'pq\_celldata' \]\[ dataIndx] which can be used by client or remote server.
Arguments
rowData (object | array)
Reference to a 1-dimensional array or object representing row data.
rowIndx (number)
Zero-based index of the row.
dataIndx (number | string)
Key name or index in rowData.
data (object)
Key–value pairs of data, where the key is a string and the value can be an array, object, string, etc.
Code examples:
Invoke the method:
//Add meta data to a row.
grid.data( {rowIndx: 2, data: { key1: value1, key2: value2 } );
//get whole meta data of 3rd row.
var data = grid.data({rowIndx: 2} ).data;
//get partial meta data of 3rd row with key name 'key1'.
var value1 = grid.data({rowIndx: 2, data: 'key1'} ).data;
//Add meta data to a cell
grid.data( {rowIndx: 2, dataIndx: 'profits',
data: { 'a': {'b': true} }
});
deleteNodes(nodes: any[ ])
Delete contiguous or non contiguous nodes/rows from the grid.
It works similar to deleteRow except that ui.source value is "deleteNodes" in the events fired during the process.
Arguments
- nodes (Array) — Array of nodes or rows.
Code examples:
Invoke the method:
//Delete 2 nodes from grid
grid.deleteNodes([node1, node2]);
deleteRow( { rowIndx, rowList, track, source, history, refresh } )
Deletes a single or multiple rows from the local data at provided rowIndx.
beforeValidate and change events are fired.
Arguments
rowIndx (Integer) — Zero-based index of the single row.
rowList (Array) — Array of objects like { rowIndx } for multiple rows.
track (Boolean) — Optional; defaults to trackModel.on.
- overrides global
trackModel.on option
source (String) — Optional; defaults to delete.
- its value is available in the events
history (Boolean) — Optional; defaults to historyModel.on.
- Determines whether this operation is added to history
refresh (Boolean) — Optional; defaults to true.
- Determines whether view is refreshed after the operation
Code examples:
Invoke the method:
//Delete the row at 5th position from top.
grid.deleteRow({ rowIndx: 4 } );
//Delete multiple rows.
grid.deleteRow({
rowList:[
{ rowIndx: 0 },
{ rowIndx: 5 }
]
});
Removes the grid functionality completely and
returns the element back to its pre initialization state.
Code examples:
Invoke the method:
grid.destroy( );
Returns row detail or hierarchy object instance.
Instance methods
getRip(node): Returns the rowIndxPage of the row for the given detail element.
rowCollapse({ rowIndx }): Collapses the detail view of the specified row.
rowExpand({ rowIndx }): Expand the detail view of a particular row.
toggleAll: Toggles the details of all rows between expanded and collapsed state.
- Example:
Detail.toggleAll();
Code examples:
Invoke the method:
grid.Detail().toggleAll();
Code examples:
Invoke the method:
grid.disable( );
Returns Drag instance of grid with draggable rows.
Instance methods
addAcceptIcon()
- Add accept icon to the draggable helper
addIcon(icon: string)
- Add custom icon to the draggable helper
addRejectIcon()
- Add reject icon to the draggable helper
getUI()
grid()
- Returns grid instance associated with draggable
Code examples:
Invoke the method:
var Drag = grid.Drag();
Code examples:
Invoke the method:
grid.enable( );
editCell( { rowIndx, rowIndxPage, dataIndx, colIndx } )
Arguments
rowIndx: Integer - Optional. The zero-based index of the row (global index).
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page (page-specific index).
dataIndx: Integer or String - Optional. The key name or index in rowData (column identifier).
colIndx: Integer - Optional. The zero-based index of the column (column position).
Description
This is a low-level method used to forcefully put a specific cell into edit mode, provided the cell is currently rendered within the viewport.
- Targeting: You must specify the row using either
rowIndx OR rowIndxPage, and specify the column using either dataIndx OR colIndx.
- Caution: This method does not check the grid's or column's
editable options. It will attempt to put the cell in edit mode even if it is explicitly marked as uneditable.
- Best Practice: Use the
isEditableCell method before calling this function to check the cell's editability rules.
Code examples:
Invoke the method:
//edit cell in 3rd row and 4th column.
grid.editCell( { rowIndx: 2, dataIndx: "profits" } );
editFirstCellInRow( { rowIndx } )
Arguments
rowIndx: Integer - The zero-based index of the row.
Description
Puts the first editable cell found in the specified row (rowIndx) into edit mode.
- Purpose: Provides a shortcut to begin editing a record at the start of its first editable field.
- Returns: A boolean indicating success or failure of entering edit mode.
Code examples:
Invoke the method:
//edit first editable cell in 3rd row.
grid.editFirstCellInRow( { rowIndx: 2 } );
Code examples:
Invoke the method:
grid.expand( );
This method is shorthand for grid.exportData({ format: 'csv })
Other parameters can be added same as exportData method.
Code examples:
Invoke the method:
grid.exportCsv( { render: true } );
This method is shorthand for grid.exportData({ format: 'xlsx' })
Other parameters can be added same as exportData method.
Code examples:
Invoke the method:
grid.exportExcel( { sheetName: "pqGrid", render: true } );
exportData({ ... })Returns: Promise
Method Description
- Core Functionality (v11.0.0): This method returns a Promise resolving to a
String, Blob, or PlainObject based on the provided configuration.
- (v9.0.0): Introduced direct export to multiple formats including
csv, htm, pdf, xlsx, wb, json, and js.
- Format Specifics:
- Format 'js': Returns a JavaScript object for manual customization before final conversion to HTML, PDF, or CSV.
- Format 'wb': Returns an intermediate JavaScript workbook object.
Return Data Type Definitions
- CSV and HTM (No Tabs): Returns a
string.
- CSV and HTM (With Tabs): Returns an
object with a sheets array.
- Sheet Object Structure:
name: string (tab name)
hidden: boolean
content: string
pics: Array of { width: number, height: number, image: string } (added in v10.0.0)
- PDF (No Tabs): Returns an
object representing a pdfmake document definition.
- Structure: Includes
headerRows and a 2D body array containing properties like alignment, border, borderColor, colSpan, link, rowSpan, and text.
- PDF (With Tabs): Returns an
object with a sheets array.
- Sheet Object Structure: Same as above, but the
content property is the pdfmake document definition object.
- JS (No Tabs): Returns an
object with head and body arrays.
- Cell Properties:
alignment, colSpan, css, html (body only), link (body only), rowSpan, text, valign.
- JS (With Tabs): Returns an
object with a sheets array where each content property follows the non-tab JS structure.
- XLSX:
- Returns a
Blob.
- Returns a base64
string if the type argument is set to 'base64'.
- Workbook (wb): Returns an
object representing the full workbook.
- Structure: Includes
activeId (0-based index) and a sheets array.
- Sheet Details:
name, columns (worksheetColumn array), frozenRows, frozenCols, headerRows, hidden, mergeCells (string array), pics (object array), and rows (worksheetRow array).
Callback Parameters (Event Listeners)
- eachCell (cell, ci, ri, column, rowData): Called for every exported body cell.
- CSV Updates:
text.
- HTML Updates:
text, html, css, alignment, valign.
- PDF Updates:
text, link, css, border (bool array), borderColor (string array), style (default 'body'), alignment, rowSpan, colSpan.
- XLSX Updates:
align, bgColor, bold, border, color, comment, italic, font, fontSize, format, formula, link, underline, valign, value, wrap.
- eachCellHead (cell, ci, ri, column): Called for every header cell. Supports the same update properties as
eachCell (PDF default style is 'head').
- eachRow (row, ri, rowData, rows): Called for every body row.
- HTML:
attr, css.
- PDF:
css.
- XLSX:
align, bgColor, bold, border, color, hidden, italic, font, fontSize, format, underline, valign, wrap.
- eachRowHead (row, ri): Called for every header row. Supports the same update properties as
eachRow.
- eachCol (col, ci, column): Called for every column in XLSX format. Supports
align, bgColor, bold, border, color, hidden, italic, font, fontSize, format, underline, valign, and wrap.
Detailed Method Arguments
- activeSheet (Boolean): (v9.0.0) If true, only the active sheet is exported.
- cssRules (String): Global CSS rules for HTML exports (e.g.,
td, th{ padding: 5px; }).
- cssTable (String): (v9.0.0) Inline CSS added directly to the
<table> tag during HTML export.
- format (String): Supports 'csv', 'html', 'json', 'pdf', 'xlsx', 'wb', 'js'.
- linkStyle (String): (v9.0.0) CSS for hyperlink cells; lower priority than cell-specific styles.
- noheader (Boolean): For non-json exports, set true to exclude the column header row.
- nopqdata (Boolean): For json exports, set true to strip
pq_ internal metadata.
- nopretty (Boolean): For json exports, set true to disable newline/indent formatting.
- render (Boolean): For non-json exports, set true to include rendered cell values. Can be overridden via
column.exportRender.
- replace (Array): (v6.2.4) For Excel, replaces strings using native JS replace parameters (e.g.,
[/Old/g, "New"]).
- separator (String): Field separator for CSV (default is ",").
- selection (String): (v9.0.0) Set to 'row' to export selected/marked rows, or 'cell' to export a specific selected range.
- sheetName (String): The name of the worksheet for XLSX exports without tabs.
- sheets (Array): (v9.0.0) Array of specific sheet names; if passed, only these sheets are exported.
- skipHiddenCols (Boolean): (v9.0.0) Prevents hidden columns from being included.
- skipHiddenRows (Boolean): (v9.0.0) Prevents hidden rows from being included.
- skipHiddenSheets (Boolean): (v9.0.0) Prevents hidden sheets from being included.
- skipBOM (Boolean): (v9.0.0) For CSV, set true to omit the Byte Order Mark used for Excel Unicode support.
- type (String): For XLSX, defines the output as 'blob' (default) or 'base64'.
- workbook (Boolean): (Deprecated v9.0.0) Use
format: 'wb' instead.
Code examples:
Invoke the method:
var data = await grid.exportData({ format: 'wb' });
//or
grid.exportData({ format: 'wb' })
.then( data => {
console.log('Data:', data);
})
.catch( error => {
console.error('Error:', error);
});
filter( { oper, rule(s), data, mode } )Returns: Array
Arguments
oper: String - Optional. The operation mode for applying rules.
- Values:
'replace' or 'add'. Default is 'add'.
'replace': Replaces all previous filter rules with the new set of rules.
'add': Appends new rules. If a new rule exists for an already-filtered dataIndx, the new rule replaces the previous one for that column.
mode: String - The global logical operator used to combine multiple column filters.
- Values:
'AND' or 'OR'. Default is filterModel.mode.
data: Array - Optional. An array of rows to be filtered.
- Purpose: If passed, the method filters this external data; the grid's internal data is not affected, and the resulting filtered array is returned.
- Default: Uses the grid's internal data.
rule > dataIndx: Integer or String - The column key name or index in rowData to apply the filter to.
rule > condition: String - The comparison operator for the filter.
- Values:
"begin", "contain", "notcontain", "equal", "notequal", "empty", "notempty", "end", "less", "great", "between", "range", "regexp", "notbegin", "notend", "lte" (less than or equal), "gte" (greater than or equal).
rule > crules: Array - An array of objects used to define multiple rules for a single column. Each object should have properties like condition, value, and value2.
rule > mode: String - The logical operator for combining crules within a single column filter.
rule > value: number|date - The primary value used for filtering.
- Special Cases: Not required for
'empty' or 'notempty'. Is an array of values for the 'range' condition. Is a regular expression for the 'regexp' condition.
rule > value2: number|date - The second value, applicable only to the "between" condition.
Description
This method applies filter rules to the grid's data. Filtering is performed locally or remotely, depending on the filterModel.type value (e.g., 'local' or 'remote').
- Rule Structure: A single filter
rule can be passed, or a collection of filter rules (an array of rule objects).
- Complex Rules: Multiple rules can be applied to a single column/
dataIndx by utilizing the rule.mode and rule.crules properties for advanced column-level filtering logic.
- External Data: If the optional
data array is passed, the method filters that data and returns the filtered result, leaving the grid's internal data untouched.
Code examples:
Invoke the method:
var filtered_data = grid.filter({
mode: 'OR',
data: [
{ country: 'India', city: 'New Delhi' },
{ country: 'India', city: 'Pune' },
{ country: 'France', city: 'Paris' },
{ country: 'France' },
{ country: 'USA', city: 'New Jersey' },
{ country: 'USA', city: 'New York' },
],
rules: [
{ dataIndx: 'country', condition: 'begin', value: 'Fr' },
{ dataIndx: 'city', condition: 'notempty' }
]
});
//filter the data in grid. (Note the data parameter is not passed)
grid.filter({
oper: 'replace',
mode: 'OR',
rules: [
{ dataIndx: 'country', condition: 'begin', value: 'Fr' },
{ dataIndx: 'city', condition: 'notempty' }
]
});
//filter data in grid with multiple conditions in single column.
grid.filter({
oper: 'replace',
rules: [
{ dataIndx: 'country', condition: 'begin', value: 'Fr' },
{
dataIndx: 'city',
mode: 'OR',
crules: [
{ condition: 'notempty' },
{ condition: 'begin', value: 'a' }
]
}
]
});
flex( { dataIndx: [dataIndx], colIndx: [colIndx] } )
Arguments
dataIndx: Array - Optional. An array of dataIndx (column keys) for the specific columns to be autosized.
colIndx: Array - Optional. An array of colIndx (column indices) for the specific columns to be autosized.
Description
This method applies a "flex" behavior to column widths, causing them to automatically adjust so that all content is visible in the cells without text wrap.
- Targeted Columns: The resizing is applied to the columns whose
dataIndx or colIndx are passed in the parameters.
- Default Behavior: If no parameters are passed, the method affects all columns currently visible in the viewport.
- Timing: This method is dependent upon the current view of the grid. Therefore, it's most effective and useful to call it after the grid has been laid out or the view is ready (e.g., after initialization or a refresh).
Code examples:
Invoke the method:
//apply flex to "products" and "contactName" field.
grid.flex( { dataIndx: [ "products", "contactName" ] } );
focus( { rowIndxPage, colIndx } )
Arguments
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page.
colIndx: Integer - Optional. The zero-based index of the column.
Description
This method is used to programmatically set focus upon a single cell in the grid.
- Targeted Focus: If both
rowIndxPage and colIndx are provided, the focus is set on that specific cell.
- Default Behavior: If no parameters are passed, the method focuses the first visible cell in the grid.
Code examples:
Invoke the method:
grid.focus( { rowIndxPage: 1, colIndx: 2 } );
//or
grid.focus();
focusHead( { ri, colIndx } )
Arguments
ri: Integer - Optional. The zero-based index of the header row (e.g., 0 for the main header row, or a higher number for sub-headers/filter rows).
colIndx: Integer - Optional. The zero-based index of the column.
Description
This method is used to programmatically set focus upon a single header cell in the grid.
- Targeted Focus: If both
ri and colIndx are provided, the focus is set on that specific header cell.
- Default Behavior: If no parameters are passed, the method focuses the first visible cell in the entire grid header.
Code examples:
Invoke the method:
grid.focusHead( { ri: 1, colIndx: 2 } );
Returns Formulas instance that's used to manipulate Excel formulas.
var F = grid.Formulas();
Instance methods
exec(String)
- This method executes Excel formula and returns its value.
computeAll()
- This method executes all Excel formulas in a worksheet.
Code examples:
Invoke the method:
var ret = grid.Formulas().exec( "SUM(A1:H1)" );
(v9.0.0) This method freezes first visible column.
Code examples:
Invoke the method:
grid.freezeFirstCol();
(v9.0.0) This method freezes top visible row.
Code examples:
Invoke the method:
grid.freezeTopRow();
getCell( { rowIndx, rowIndxPage, dataIndx, colIndx, vci } )Returns: jQuery
Returns a grid cell wrapped in a jQuery object if the cell is currently visible in the viewport.
You can specify:
- rowIndx or rowIndxPage
- colIndx, dataIndx, or vci
Where:
- vci = visible column index
colIndx = refers to the index of column in colModel array
colIndx: -1 = refers to the numberCell (the special index column on the left)
Code examples:
Invoke the method:
//get cell in 3rd row and 4th column.
var $cell = grid.getCell( { rowIndx: 2, dataIndx: "contactName" } );
getCellFilter( { dataIndx, colIndx, vci } )Returns: jQuery
It returns header filter cell wrapped in jQuery object if cell is displayed in the viewport
Either colIndx, dataIndx or vci can be provided.
vci is visible column index.
Code examples:
Invoke the method:
//get filter header cell in 4th column.
var $cell = grid.getCellFilter( { colIndx: 3 } );
getCellHeader( { dataIndx, colIndx, ri, vci } )Returns: jQuery
It returns header cell wrapped in jQuery object if cell is displayed in the viewport.
Either colIndx, dataIndx or vci can be provided.
ri is useful in case of grouped columns; when omitted, only lower level header cells are returned.
vci is visible column index.
Code examples:
Invoke the method:
//get header cell in 4th column.
var $cell = grid.getCellHeader( { colIndx: 3 } );
getCellsByClass( { cls } )Returns: Array
Arguments
cls: String - The name of a single CSS class to search for.
Description
Used to retrieve data for all cells that have the specified CSS class name (cls) applied to them.
The class name could have been added using the addClass() method or through the row data JSON property, rowData.pq_cellcls.
- Inclusion: This method searches and returns all matching cells, including those that are not currently visible in the grid's viewport (e.g., filtered out or outside the virtualization range).
- Returns: An Array of objects, where each object contains the cell's location and data:
{ rowData: rowData, rowIndx: rowIndx, dataIndx: dataIndx }
Code examples:
Invoke the method:
var cellList = grid.getCellsByClass( { cls : 'pq-delete' } );
//get first cell having the above class.
var cell = cellList[0],
rowData = cell.rowData,
rowIndx = cell.rowIndx,
dataIndx = cell.dataIndx;
getCellIndices( { $td } )Returns: Object
Arguments
$td: jQuery - The <td> HTML element representing the cell, wrapped in a jQuery object.
Description
Used to retrieve the data indices associated with a given cell element ($td).
- Returns: An Object containing the following two properties:
rowIndx (The zero-based index of the row).
dataIndx (The key name or index in rowData for the column).
Code examples:
Invoke the method:
var obj = grid.getCellIndices( { $td : $td } );
var dataIndx=obj.dataIndx, rowIndx=obj.rowIndx;
getChanges( { format, all } )Returns: Object
Arguments
format: String - 'byVal', 'raw', or null.
all: Boolean - Applicable only when format is 'byVal'. When true, it returns all fields in the updateList.
Description
Gets uncommitted changes (added rows, updated rows, and deleted rows) when tracking is on.
format is null (or not passed): Dirty rows are returned by reference (rowData).
format is 'byVal': Dirty rows are cloned and returned.
- By default, only the fields which are dirty are returned, along with the primary key of the record.
- If the
all parameter is true, all fields in the row are returned. (In previous versions, all fields were returned by default.)
format is 'raw': The internal representation and detailed information, including old values of cells present in the dirty data, are returned
Code examples:
Invoke the method:
var changes = grid.getChanges( );
//Format of js object returned by this method is as below:
{
updateList: [rowData1, rowData2..],
addList: [rowData1, rowData2..],
deleteList: [rowData1, rowData2..],
oldList: [rowData1, rowData2..]
}
var changes = grid.getChanges( {format: 'byVal'} );
//Format of js object returned by this method is as below:
{
updateList: [row1, row2..],
addList: [row1, row2..],
deleteList: [row1, row2..],
oldList: [rowData1, rowData2..]
}
getColIndx( {dataIndx, column } )Returns: Integer
Arguments
dataIndx: Integer or String - The key name or index in rowData.
column: Object - A reference to the column object within the colModel.
Description
Used to retrieve the colIndx (column index) when either the dataIndx or the specific column object is known.
- Returns: The column index (
colIndx) as an integer.
- Failure: Returns
-1 if no matching column is found.
Code examples:
Invoke the method:
var colIndx = grid.getColIndx( { dataIndx: "profits" } );
getColumn( { dataIndx } )Returns: Object
Arguments
dataIndx: Integer or String - The key name or index in rowData.
Description
Used to retrieve the column object from the colModel when its corresponding dataIndx is known.
- Returns: The matching column object.
- Failure: Returns
null if no column with the specified dataIndx is found.
Code examples:
Invoke the method:
var column = grid.getColumn({ dataIndx: "profits" } );
getCMPrimary( )Returns: Array
Used to get primary colModel of lower most columns in the header.
Primary colModel is the original colModel of lowest columns when pivoting is on.
Current and primary colModel are same when pivoting is off.
Code examples:
Invoke the method:
var colModel = grid.getCMPrimary( );
getColModel( )Returns: Array
Used to get current colModel of grid. It's different from options > colModel in the case of header grouping as it provides information about
the lower most columns in the header.
Code examples:
Invoke the method:
var colModel = grid.getColModel( );
getData({ dataIndx?: [], data?: [] }): any[]Returns: Array
Arguments
dataIndx: Array - Optional. An array of dataIndx (column keys) to be included in the returned data objects.
data: Array - Optional. An array of row objects to use as the source data instead of the grid's internal cache.
Description
This method is used to get an array of unique row objects (data records).
Data Source and Content
- Default: It sources data from the grid's local data cache:
dataModel.data (filtered data) concatenated with dataModel.dataUF (unfiltered data).
- Custom Source: If the optional
data parameter is passed, the array of unique row objects is taken from that external data array instead of the grid's cache.
- Filtering Columns: If
dataIndx is specified, the returned row objects will only contain those specific fields (columns).
- Row Grouping: In the case of row grouping in the grid, this method excludes title and summary rows.
Code examples:
Invoke the method:
var data = grid.getData({ dataIndx: ['ProductName', 'UnitPrice'] });
//returns
[ { 'ProductName': 'ABC', UnitPrice: 30 }, { 'ProductName': 'DEF', UnitPrice: 15 },... ]
getDataCascade( dataIndx, groupIndx? )Returns: Array
Arguments
dataIndx: Integer or String - The key name or index in rowData for the column you want unique values from.
groupIndx: Integer or String - Optional. The dataIndx of the column used for row grouping.
Description
Returns an options array of unique values for a specified column (dataIndx).
The unique values are obtained from the data after applying filters from all other pre-filtered columns. These options are specifically used by the header filter range condition to enable cascade filtering (where filtering one column restricts the available filter options in subsequent columns).
Code examples:
Invoke the method:
var options = grid.getDataCascade('ShipRegion', 'ShipCountry');
//returns [{ShipCountry: 'Brazil', ShipRegion: 'RJ'}, { ShipCountry: 'Brazil', ShipRegion: 'SP' }]
Gets an object containing currently edited cell and editor corresponding to edited cell.
Returns empty object if no cell is being edited.
Code examples:
Invoke the method:
var obj = grid.getEditCell( );
var $td = obj.$td; //table cell
var $cell = obj.$cell; //editor wrapper.
var $editor = obj.$editor; //editor.
getEditCellData()Returns: String
Gets the data (saved or unsaved) associated with currently edited cell.
Returns null if no cell is being edited.
Code examples:
Invoke the method:
var dataCell = grid.getEditCellData( );
Gets the coordinates of focused cell in form of object with properties:
rowIndxPage]], colIndx]]
Returns null if no cell is focused.
Code examples:
Invoke the method:
var obj = grid.getFocus( );
Gets the coordinates of focused header cell in form of object with properties:
ri]], colIndx]]
Returns null if no header cell is focused.
Code examples:
Invoke the method:
var obj = grid.getFocusHead( );
getHeadIndices( th )Returns: Object
Arguments
th: Element - The HTML element corresponding to the header cell (<th>).
Description
Used to retrieve the index information associated with a header cell (<th> element).
- Returns: An object containing the following properties:
ri: number (Row index of the header cell within the header structure)
column: column (The column object reference)
colIndx: number (The visible column index)
filterRow: boolean (Indicates if the cell belongs to a filter row)
Code examples:
Invoke the method:
var obj = grid.getHeadIndices( th );
(v9.0.0) Note: this method has been replaced by instance method. Gets the instance of grid for direct access to grid API. Returns an object { 'grid': grid }
Code examples:
Invoke the method:
var grid = $grid.pqGrid( 'getInstance' ).grid;
//any method can be called on grid directly
var $tr = grid.getRow( { rowIndx: 2 });
getNextVisibleCI( ci )Returns: Integer
Arguments
ci: Integer - The starting column index.
Description
Helps retrieve the index of the next visible column relative to the provided starting column index (ci).
- Purpose: Useful for iterating through only the visible columns in a grid.
- Returns: The integer index of the next visible column.
Code examples:
Invoke the method:
ci = grid.getNextVisibleCI( ci );
getNextVisibleRIP( rip )Returns: Integer
Arguments
rip: Integer - The starting row index.
Description
Helps retrieve the index of the next visible row in the grid, starting from the row index provided by the rip parameter.
- Purpose: Useful for iterating through only the visible rows, skipping any hidden or collapsed rows.
- Returns: The integer index of the next visible row.
Code examples:
Invoke the method:
rip = grid.getNextVisibleRIP( rip );
getPrevVisibleCI( ci )Returns: Integer
Arguments
ci: Integer - The starting column index.
Description
Helps retrieve the index of the previous visible column in the grid, relative to the provided starting column index (ci).
- Purpose: Useful for backward iteration or navigation, skipping any hidden columns.
- Returns: The integer index of the previous visible column.
Code examples:
Invoke the method:
ci = grid.getPrevVisibleCI( ci );
getPrevVisibleRIP( rip )Returns: Integer
Arguments
rip: Integer - The starting row index.
Description
Helps retrieve the index of the previous visible row in the grid, relative to the provided starting row index (rip).
- Purpose: This method is used for backward iteration or navigation, automatically skipping over any hidden or collapsed rows (e.g., in a grouped or tree view).
- Returns: The integer index of the previous visible row.
Code examples:
Invoke the method:
rip = grid.getPrevVisibleRIP( rip );
Arguments
This method takes no arguments.
Description
This method is used to prepare and return data for exporting floating images from the grid to formats like PDF or HTML.
- Returns: An array of floating image objects found within the grid.
- (v11.0.0) Returns a Promise that resolves to this array.
- Image Object Properties: Each object in the array contains the following details:
width: number (The width of the image)
height: number (The height of the image)
image: string (The base64 encoded value of the image data)
Code examples:
Invoke the method:
var pics = await grid.getPics( );
getRow( { rowIndxPage } )Returns: jQuery
Arguments
rowIndxPage: Integer - The zero-based index of the row on the current page.
Description
Used to retrieve a specific HTML table row element (<tr>) when either the global rowIndx (not explicitly listed in arguments, but implied by context) or the page-specific rowIndxPage is known.
- Returns: The
<tr> element for the specified row, wrapped in a jQuery object.
- Failure: It returns an empty jQuery object if the requested row is not currently rendered within the grid's visible viewport (i.e., due to virtualization).
Code examples:
Invoke the method:
//get 3rd row on current page.
var $tr = grid.getRow( {rowIndxPage: 2} );
getRowData( { rowIndx, rowIndxPage, recId, rowData } )Returns: Object or Returns: Array
Arguments
rowIndx: Integer - The zero-based index of the row (global index).
rowIndxPage: Integer - The zero-based index of the row on the current page (page-specific index).
recId: Object - The value of the record's primary key.
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
Description
This method returns a reference to the row/record data in either JSON or Array format.
- Retrieval: It retrieves the row data when any of the following parameters are known:
rowIndx, rowIndxPage, recId, or rowData.
- Behavior: If the
rowData object/array is itself passed as a parameter, the method simply returns the same reference that was passed in.
- Returns: A reference to the row data (
Object or Array).
Code examples:
Invoke the method:
//get reference to 3rd row on current page.
var rowData = grid.getRowData( {rowIndxPage: 2} );
getRowIndx( { $tr, rowData } )Returns: Object
Arguments
$tr: jQuery - The <tr> HTML element wrapped in a jQuery object.
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
Description
Used to retrieve the index information for a specific row when either its jQuery <tr> element ($tr) or its data object (rowData) is known.
- Returns: An object containing both index properties:
rowIndx (The global zero-based index of the row).
rowIndxPage (The page-specific zero-based index of the row on the current page).
- Failure: It returns an empty object (
{}) if no matching row is found or if the row is not currently rendered.
Code examples:
Invoke the method:
var obj = grid.getRowIndx( { $tr : $tr } );
var rowIndx = obj.rowIndx;
getRowsByClass( { cls } )Returns: Array
Arguments
cls: String - The name of a single CSS class to search for.
Description
Used to retrieve data for all rows that have the specified CSS class name (cls) applied to them.
The class name could have been added using the addClass() method or through the row data JSON property, rowData.pq_rowcls.
- Inclusion: This method searches and returns all matching rows, including those that are not currently visible in the grid's viewport (e.g., filtered out or outside the virtualization range).
- Returns: An array of objects, where each object contains the full row data and its index:
{ rowData: rowData, rowIndx: rowIndx }
Code examples:
Invoke the method:
var arr = grid.getRowsByClass( { cls : 'pq-delete' } );
//get first row having the above class.
var rowData = arr[0].rowData;
var rowIndx = arr[0].rowIndx;
Gets previously saved state of a grid in localStorage.
Code examples:
Invoke the method:
var obj = grid.getState();
getViewPortIndx( )Returns: Object
Arguments
initV: Integer - The rowIndx (global index) of the first rendered row in the viewport.
finalV: Integer - The rowIndx (global index) of the last rendered row in the viewport.
initH: Integer - The colIndx (column index) of the first rendered column in the viewport.
finalH: Integer - The colIndx (column index) of the last rendered column in the viewport.
Description
This method is used to retrieve the index range of rendered rows and columns within the grid's visible viewport.
- Context: Because the Grid uses virtualization (it renders only the visible rows and columns in the viewport to save memory and improve performance), this method tells you exactly which data indices are currently being displayed on the screen.
- Returns: An object containing the four index properties (
initV, finalV, initH, finalH) that define the rendered area.
Code examples:
Invoke the method:
let {initV, finalV, initH, finalH} = grid.getViewPortIndx( );
(v9.1.0) Returns XHR instance used by grid for remote Ajax interactions.
Code examples:
Invoke the method:
var xhr = grid.getXHR();
goToPage( { rowIndx, page } )
Arguments
rowIndx: Integer - The zero-based index of the row (used to calculate the target page number).
page: Integer - The target page number, starting from 1.
Description
This method is used to navigate the grid's pagination to a specific page. You can choose to pass either the target page number (page) or the global row index (rowIndx), from which the necessary page number will be calculated.
- Purpose: To programmatically change the currently displayed page in the grid.
Code examples:
Invoke the method:
//navigate to 3rd page.
grid.goToPage( { page: 3} );
Returns group instance.
var Group = grid.Group();
Instance methods
addGroup(dataIndx: string | integer, indx?: integer)
addNodes(nodes: any[], parent: any, indx?: number)
- Inserts new nodes to a parent node at an optional index. New nodes are appended to the parent when no
indx is provided. Undo is not supported and addNode event is fired during the process.
checkAll()
- Check all checkboxes.
beforeCheck and check events are fired during the process.
checkNodes(nodes: any[])
- Checks the specified nodes.
beforeCheck and check events are fired during the process.
collapse(level: integer)
collapseAll(level?: integer)
collapseTo(address: string)
deleteNodes(nodes: any[])
- Deletes an array of nodes. Undo is not supported and
deleteNode event is fired during the process.
expand(level: integer)
expandAll(level?: integer)
expandTo(address: string)
getCheckedNodes(all?: boolean)
getChildren(node?: any)
- Returns an array containing the children nodes of a passed
node. Returns root nodes when node is not passed.
getChildrenAll(node: any)
- Returns an array containing all the children, grandchildren (and so on ..) nodes of a passed
node.
getNode(id)
getParent(node)
getSummary(node)
isAncestor(childNode, ancestorNode)
isFolder(node: any)
isOn()
- Returns true if row grouping is turned on on at least single level.
moveNodes(nodes: any[], parent: any, indx?: number)
isHeadChecked()
- Returns true, false or null (indeterminate state) depending upon checkbox state in header cell.
option(options: Object)
removeGroup(dataIndx: string | integer)
unCheckAll()
- Uncheck all checkboxes.
beforeCheck and check events are fired during the process.
unCheckNodes(nodes: any[])
- Unchecks the specified nodes.
beforeCheck and check events are fired during the process.
hasClass( { rowData, rowIndx, dataIndx, cls } )Returns: Boolean
Arguments
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
rowIndx: Integer - The zero-based index of the row.
dataIndx: Integer or String - The key name or index in rowData (only required to check a specific cell).
cls: String - The name of a single CSS class to check for.
Description
This method checks whether a row or a specific cell has a given CSS class (cls) applied to it.
- Targeting a Row: To check a whole row, you must pass either
rowData or rowIndx (but not both), along with the cls.
- Targeting a Cell: To check a specific cell, you must pass either
rowData or rowIndx along with the cell's unique identifier (dataIndx) and the cls.
- Returns: A boolean value (
true if the class is present, false otherwise).
Code examples:
Invoke the method:
//Check whether 3rd row has class 'pq-delete'.
var hasClass = grid.hasClass(
{rowIndx: 2, cls: 'pq-delete'}
);
//Check whether 3rd row & 'profits' field has class 'pq-delete'.
var hasClass = grid.hasClass(
{rowIndx: 2, dataIndx: 'profits', cls: 'pq-delete'}
);
Hides the loading icon in center of the grid after asynchronous operation is complete.
Code examples:
Invoke the method:
grid.hideLoading( );
Returns history instance
let History = grid.History();
Instance methods
canRedo()
- Can further redo action can be performed?
Returned Type: boolean
canUndo()
- Can further undo action can be performed?
Returned Type: boolean
redo()
- Repeats add, update, or delete operations which have been previously reversed. Fires
history event.
reset()
- Clears all history without making any change in current data in grid. Fires
history event.
Usually called after commiting all operations in the grid.
undo()
- Reverses add, update, or delete operations. Fires
history event.
- Exmaple:
grid.History().undo();
Note: undo and redo can be invoked multiple times until all the operations have been undone or redone. Multiple cells affected by copy/paste or updateRow() method are considered as a single operation.
importWb({ workbook, extraCols?, extraRows?, keepCM?, headerRowIndx?, sheet? })
Arguments
extraCols: Integer - The number of extra empty columns to be added to the grid alongside the imported data.
extraRows: Integer - The number of extra empty rows to be added to the grid alongside the imported data.
keepCM: Boolean - If true, the original colModel (column structure) of the grid is retained for data binding.
headerRowIndx: Integer - The zero-based row index within the imported worksheet that should be treated as the grid's header row.
sheet: String or Integer - The index or name of the specific sheet to be imported. If omitted, all worksheets are imported when the grid has tabs; otherwise, only the first worksheet is imported.
workbook: PlainObject - The JSON workbook object containing the data to be imported.
Description
Imports data and structure from a JSON workbook object into the grid.
Code examples:
Invoke the method:
grid.importWb({
sheet: 0,
workbook: {
sheets:[
{
name:'PQ pro',
frozenRows: 1,
frozenCols: 1,
mergeCells:[
"A5:E7"
],
columns:[
{width:210},
{hidden:true}
],
rows:[
{
cells:[
{
value: 'Hello World',
bgColor: '#ff0000',
color: '#00ff00',
align: 'center',
fontSize: 32
},
{
value: '12/12/2011'
},
{
value: 3000000,
bgColor: '#ff00ff'
},
{
value: 3000000,
bgColor: '#ff00ff',
format:"$##,###.00"
},
{
value: pq.formulas.TODAY(),
bgColor: '#ffff00',
format:"ddd mm yyyy",
formula: 'TODAY()'
}
]
},
{
indx: 4,
//hidden: true,
cells:[
{
formula: 'TODAY()+5'
}
]
}
]
}
]
}
})
(v9.0.0) This method replaces the getInstance method. Returns the instance of grid for direct access to grid API.
Code examples:
Invoke the method:
var grid = $grid.pqGrid( 'instance' );
//any method can be called on grid directly
var $tr = grid.getRow( { rowIndx: 2 });
(v11.1.0) Returns true if the grid is currently displayed in collapsed mode.
isDirty({ rowIndx, rowData })Returns: Boolean
Arguments
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
rowIndx: Integer - The zero-based index of the row.
Description
Checks for uncommitted changes (dirty data) in the grid since the last commit or since tracking was enabled.
- Global Check: When called without arguments, it returns a boolean value indicating if any row in the entire grid has been added, updated, or deleted.
- Individual Record Check: If either
rowData or rowIndx is passed, the method checks only that specific record to see if it has been modified.
- Returns: A boolean value (
true if a change is detected, false otherwise).
Code examples:
Invoke the method:
grid.isDirty( );
isEditable( { rowIndx, dataIndx } )Returns: Boolean
Arguments
rowIndx: Integer - The zero-based index of the row.
dataIndx: Integer or String - The key name or index in rowData (identifies the column/cell).
Description
Checks whether a specific cell (identified by rowIndx and dataIndx) is finally editable.
The method determines editability by considering both the column-specific editability option (column.editable) and the global grid editable option. This method is used internally by the grid to control the cell editing feature.
- Returns: A boolean value (
true if the cell is editable, false otherwise).
Code examples:
Invoke the method:
grid.isEditable( { rowIndx: 3, dataIndx: "profits" } );
isEditableCell( { rowIndx, dataIndx } )Returns: Boolean
Arguments
rowIndx: Integer - The zero-based index of the row.
dataIndx: Integer or String - The key name or index in rowData (identifies the column/cell).
Description
Checks the editability of a specific cell based only upon the column-specific column.editable option.
- Context: This method is focused solely on the column configuration, unlike other methods that check global grid options.
- Returns: A boolean value (
true or false) indicating editability.
- Special Return Value: Returns
undefined if the column.editable option itself or the return value of its associated callback function is undefined.
Code examples:
Invoke the method:
grid.isEditableCell( { rowIndx: 3, dataIndx: "profits" } );
isEditableRow( { rowIndx } )Returns: Boolean
Arguments
rowIndx: Integer - The zero-based index of the row.
Description
Checks the editability of an entire row based only upon the global editable option set for the grid.
- Context: This method determines if the grid allows editing for the specified row at the global level, without checking individual column settings.
- Returns: A boolean value (
true or false) indicating editability.
- Special Return Value: Returns
undefined if the global editable option itself or the return value of its associated callback function is undefined.
Code examples:
Invoke the method:
grid.isEditableRow( { rowIndx: 3 } );
(v11.1.0) Returns true if the grid is currently displayed in fullscreen mode.
isValid( { rowData, rowIndx, dataIndx, value, data, allowInvalid, focusInvalid } )Returns: Object
Arguments
rowIndx: Integer - The zero-based index of the row.
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
dataIndx: Integer or String - The key name or index in rowData (identifies the column/cell).
data: Array - A collection of rows (2D array or array of objects) similar to dataModel.data.
value: Variant - The cell value of any type to be validated.
allowInvalid: Boolean - If true, the method adds an invalid class to invalid cells and returns the collection of invalid cells.
focusInvalid: Boolean - If true, the method focuses the first invalid cell and displays a tooltip (only applicable when allowInvalid is false).
Description
This method validates a cell, a row, or a collection of row data against the rules defined in column.validations[].
Validation Scenarios
The scope of validation depends on the parameters provided:
- Validate a Single Cell: Pass
rowData or rowIndx AND dataIndx.
- Validate a Single Value: Pass
dataIndx AND value (validates the value against the column's rules without changing the grid).
- Validate a Single Row: Pass only
rowData or rowIndx.
- Validate Collection of Rows (Data): Pass the
data parameter (an array of row objects).
Return Behavior
- All Valid: If all checked cells are valid, the method returns an object:
{ valid: true }.
allowInvalid: true (Tolerant Mode):
- The method adds the class
editModel.invalidClass to all invalid cells.
- It returns a collection of all invalid cells.
allowInvalid: false (Strict Mode):
- If invalid cells are found, the method stops at the first one.
- If
focusInvalid is also true, the first invalid cell is focused, and a tooltip containing the validation message is displayed.
- It returns the index information of the first invalid cell:
{ valid: false, dataIndx: dataIndx }.
Code examples:
Invoke the method:
//validate a single cell against a value which is usually taken from editor.
grid.isValid( { rowIndx: 3, dataIndx: "profits", value: 12.45 } );
//validate 4th row.
grid.isValid( { rowIndx: 3 } );
//validate a row whose reference (rowData) is known.
grid.isValid( { rowData: rowData } );
isValidChange( { allowInvalid, focusInvalid } )Returns: Object
Arguments
allowInvalid: Boolean - If true, the method adds an invalid class to any invalid cell(s).
focusInvalid: Boolean - If true, the method puts focus on the first invalid cell (only applicable when allowInvalid is false).
Description
This method checks the validity of all uncommitted changes (specifically row additions and row updates) currently present in the grid's data.
Return Behavior
The return object and behavior depend on the parameters:
All Changes Valid: If all changes pass validation, the method returns: { valid: true }.
allowInvalid: true (Tolerant Mode):
- The method adds the invalid CSS class to all invalid cells found.
- It returns an object containing the result and a collection of all invalid cells:
{ cells: cells, valid: valid } (where cells is an array of invalid cell objects).
allowInvalid: false (Strict Mode):
- The method stops at the first invalid cell detected.
- If
focusInvalid is also true, the first invalid cell is focused, and a tooltip displaying the validation message (validation.msg) is shown next to it.
- It returns the index information of that first invalid cell:
{ valid: false, dataIndx: dataIndx }
Code examples:
Invoke the method:
//validate changes in the grid.
var valid = grid.isValidChange().valid;
loadState( { state, refresh } )Returns: Boolean
Arguments
state: String - Optional. The previously saved state (as a JSON string).
- Default: If omitted, the method attempts to load the state from the browser's local storage.
- Usage: If passed, the grid is restored from this string instead of local storage.
refresh: Boolean - Optional. Controls the grid's refresh behavior.
- Default:
true.
- Usage: Set to
false if you need to manually control the refresh process after the state is loaded.
Description
This method restores the configuration and display state of the grid to a point that was previously saved using its counterpart method, saveState().
What is Restored
The method restores primarily layout and control parameters, including:
- Dimensions: Height and width of the grid.
- Layout: Frozen rows and frozen columns.
- Columns: Column order, column widths, and column visibility.
- Data Controls: Applied sorting, paging, filtering, and grouping settings.
Important Notes
- Data: It does not restore the previous data of the grid; only the settings applied to the data.
- Columns: Any extra or removed columns in the grid's current state (since the state was saved) are not changed by this method.
- Refresh: The method calls
refreshDataAndView() to update the display, unless the optional refresh parameter is set to false.
- Returns: A boolean value indicating whether the restoration was successful (
true/false).
Code examples:
Invoke the method:
//restore the previous state of grid.
var success = grid.loadState( );
moveNodes(nodes: any[ ], rowIndx?: number)
Arguments
nodes: Array - An array of nodes or rows (the data records to be moved).
rowIndx: Integer - Optional. The zero-based index of the target row where the nodes/rows should be moved before.
Description
This method moves contiguous or non-contiguous nodes/rows from their current location to a new location within the grid's data structure.
Movement Logic
- Specified Location: If
rowIndx is passed, the nodes/rows are moved and inserted before the row at that index.
- Default Location: If
rowIndx is not passed (or is undefined), the nodes/rows are moved to the end of the data in the grid.
Limitations
- This method is incompatible with remote paging.
- Undo/Redo: Undo functionality is not supported.
- Event: The
moveNode event is fired at the end of the process.
Code examples:
Invoke the method:
//Move 2 nodes to rowIndx: 10
grid.moveNodes([node1, node2], 10);
Arguments
event: String - One or more space-separated list of event names (e.g., 'change refresh').
fn: function - Optional. A reference to the specific callback function that was originally bound to the event(s).
Description
This method removes event listener(s) from the grid instance.
- Usage: It is called directly on the instance of the grid object (e.g.,
grid.off(...)).
- Scope: It only removes event listeners that were previously bound using the
on and one methods.
- Functionality:
- If the optional
fn parameter is provided, only that specific callback function is removed from the specified event(s).
- If the optional
fn parameter is omitted, all listeners for the specified event(s) are removed.
Code examples:
Invoke the method:
instance.off( 'beforeSort', fn );
Arguments
event: String - One or more space-separated list of event names (e.g., 'change refresh beforeEdit').
fn: function - A callback function that is executed when any of the specified events are fired.
- Arguments: The callback function receives two arguments:
evt and ui.
Description
This method is used to bind a listener (the callback function fn) to one or more grid events (event).
- Binding: The event listener is attached directly to the grid instance (e.g.,
grid.on(...)).
- Purpose: Allows you to execute custom logic whenever a specific action or lifecycle stage occurs within the grid.
Code examples:
Invoke the method:
instance.on( 'beforeSort', function( evt, ui ){
});
Arguments
event: String - One or more space-separated list of event names (e.g., 'ready load').
fn: function - A callback function that is executed when any of the specified events are fired.
- Arguments: The callback function receives two arguments:
evt and ui.
Description
This method is similar to the on() method but is used to bind an event listener that is executed only once.
- Behavior: The callback function (
fn) is fired the first time any of the specified events occurs. After execution, the listener is automatically removed from the grid instance, ensuring it won't fire again for subsequent event occurrences.
Code examples:
Invoke the method:
instance.one( 'beforeSort', function( evt, ui ){
});
Gets an object containing key/value pairs representing the current grid options hash.
Code examples:
Invoke the method:
var options = grid.option( );
option( optionName )Returns: Object
Arguments
optionName: String - The name of the option whose current value you want to retrieve.
Description
Gets the value currently associated with the specified grid option (optionName).
- Returns: The current value of the requested option.
Code examples:
Invoke the method:
var disabled = grid.option( "disabled" );
option( optionName, value )
Sets the value of the grid option associated with the specified optionName.
Code examples:
Invoke the method:
grid.option( "disabled", true );
Arguments
optionName: Object - A map of option-value pairs (e.g., { width: 500, editable: false }) containing the grid options to be set or updated.
Description
Sets or updates one or more options for the Grid instance after it has been initialized.
- Usage: This is the primary method for changing grid behavior, appearance, or data models dynamically during runtime.
- Returns: The Grid instance, allowing for method chaining.
Code examples:
Invoke the method:
grid.option( {disabled: true} );
It gets the data for current page.
In case of grouped rows data, this method returns all rows on current page.
Code examples:
Invoke the method:
//get data for current page.
var data = grid.pageData( );
Returns the widget instance of pager.
Code examples:
Invoke the method:
var pager = grid.pager( );
Asynchronous method to paste the copied content from clipboard. beforePaste and paste events are fired during the process.
(v11.0.0) asynchronous
Code examples:
Invoke the method:
//paste data.
grid.paste( );
Returns Pic instance that's used to manipulate floating pictures in the grid.
var Pic = grid.Pic();
Instance methods
add(name: string, src: string, from: array, to: array, cx: number, cy: number)
- Adds a floating image to the grid. See
pics option for more details of the parameters.
getId(img: HTMLElement)
- Returns id of the passed image node.
remove(id: number)
- Removes image from the grid. It supports undo and redo.
-Example: grid.Pic().remove( 3 );
Ignores the unsaved changes in currently edited cell and brings cell out of edit mode.
It fires quitEditMode event.
It can be useful to invoke in custom editors.
Code examples:
Invoke the method:
//quit editing of cell
grid.quitEditMode( );
Returns a Range instance that represents a collection of rectangular areas (blocks) in the grid
and allows collective manipulation of the cells lying within the range.
Range Constructor Arguments
range?: string
- Range in spreadsheet format, e.g.
"A4:D10".
r1: number
- Row index of the first row.
c1: number
- Column index of the first column.
r2: number
- Row index of the last row.
c2: number
- Column index of the last column.
rc: number
- Number of rows in the range.
cc: number
- Number of columns in the range.
style?: string
- CSS style applied to the range.
Examples:
var range = grid.Range({ r1: 2, r2: 4, style: 'background-color:rgba(255,0,0,0.2);border:1px solid red;' });
var range = grid.Range("2:2"); // range of a single row.
var range = grid.Range("2:4"); // range of 3 rows.
var range = grid.Range("C2"); // range of a single cell.
var range = grid.Range("B2:D5"); // block range.
var range = grid.Range("A2,B2:D5,2:4"); // collection of ranges.
var range = grid.Range({ r1: 2 }); // single row.
var range = grid.Range({ r1: 2, r2: 4 }); // 3 rows.
var range = grid.Range({ r1: 2, rc: 2 }); // 2 rows.
var range = grid.Range({ r1: 2, c1: 3 }); // single cell.
var range = grid.Range({ c1: 2, c2: 4 }); // 3 columns.
var range = grid.Range({ c1: 2, cc: 4 }); // 4 columns.
var range = grid.Range({ r1: 2, c1: 2, r2: 5, c2: 4 }); // block range.
var range = grid.Range([
{ r1: 2, c1: 2, r2: 5, c2: 4 },
{ r1: 7, c1: 2, r2: 3, c2: 4 }
]); // collection of block ranges.
Instance methods
address(): []
- Returns an array of range objects in this range
- Each range object has:
r1, r2: row index of first and last row
c1, c2: column index of first and last column
type: one of row, cell, column, block
addressLast(): {r1, c1, r2, c2, type}
- returns last range object from this range
add({ r1: r1, c1: c1, r2: r2, c2: c2 })
- It adds a block of cells to this range. There should not be any overlap or duplicate in the new block with existing blocks in this range.
addCol( right?: boolean, col?: object )
- (v9.0.0) It adds columns either to the left or right of this range.
- Number of added columns is equal to number of columns in this range.
- Properties of added columns are copied from col parameter.
addRow( below?: boolean, row?: object )
- (v9.0.0) It adds rows either above or below the this range.
- Number of added rows is equal to number of rows in this range.
- Properties of added rows are copied from row parameter.
align( str?: string): String
- It defines the horizontal alignment ( 'left', 'center' or 'right' ) of all cells in the range.
- It returns horizontal alignment of first cell in the range when no parameter is passed.
border( type: string, style: string, color: string)
clear()
- clears or removes the contents of cells lying within this range.
- (v11.0.0) Also removes the style, prop and attr along with content.
comment( text?: string): String
- It defines the comment of all cells in the range.
- It returns comment of first cell in the range when no parameter is passed.
copy( obj?: { dest?: object, render?: boolean, header?: boolean, plainFmt?: boolean } ): Promise
- Asynchronous method to copy the contents of cells within the range.
- The copied content can be used later with paste.
- If the
dest parameter is provided, the copied content is immediately pasted into the destination range.
- Copied cells use formatted/rendered values when
render: true.
This option:
- Overrides
copyModel.render
- Is overridden by
column.exportRender
- Applies only if
plainFmt is false
- Header cells are included when
header: true.
This option overrides copyModel.header.
- (v11.0.0) When
plainFmt: true, cell values are copied to clipboard as single plain values (no separate value + format).
This option overrides copyModel.plainFmt.
- (v11.0.0) Changed to asynchronous.
cut( obj?: { dest?: object, render?: boolean, header?: boolean } ): Promise
- Asynchronous method to cut the content of this range
- Similar to
copy, but the original cells are cleared after the paste operation is performed.
- (v11.0.0) Changed to asynchronous.
count(): Integer
- It returns the number of cells within this range
deleteCol()
- (v9.0.0) Deletes the columns in this range.
deleteRow()
- (v9.0.0) Deletes the rows in this range.
eachCol( callback: (column: column, colIndx: number) => void )
- Invokes the callback once for every column in this range.
For example, if the range contains 12 cells (4 rows × 3 columns), the callback is executed 3 times.
eachRow( callback: (rowData: object, rowIndx: number) => void )
- Invokes the callback once for every row in the range.
For example, if the range contains 12 cells (4 rows × 3 columns), the callback is executed 4 times.
enable( enable?: boolean ): boolean
- Defines the editability of all cells in the range.
- When no parameter is passed, it returns the editability of the first cell in the range.
format( val?: string ): string
- Sets the format for all cells in the range.
- When no parameter is passed, it returns the format of the first cell in the range.
freezePanes()
- (v9.0.0) Freezes panes at the initial coordinates of the first selection.
hideCols()
- Hides the columns in the selection.
hideRows()
- Hides the rows in the selection.
index( range ): number
- Finds the index of a single range within the collection only if it matches exactly.
Returns -1 if no exact match is found.
indexOf( range ): number
- Finds the index of a single range within the collection if the range lies within or matches exactly any other range.
Returns -1 otherwise.
link( url?: string, label?: string ): string
- (v9.0.0) Sets the URL of all cells in the range, or returns the URL of the first cell when no URL is provided.
- (v11.0.0) The first cell in the range is set to a
pq.Link object; the label parameter was added.
merge( refresh?: boolean )
- Merges all cells in the range into a single cell.
pic( file: File, offsetX?: number, offsetY?: number )
- Adds a floating image at the first cell in this range
- The image spans multiple cells if its width × height exceeds the size of the first cell in this range
- If this range is empty, the image is added to the first cell of the grid.
offsetX = pixels from the left edge of the cell.
offsetY = pixels from the top edge of the cell.
picCell( file: File | string, width?: number, name?: string )
- (v11.0.0) Asynchronous method to add an image in the first cell of the range.
file may be a File object, a URL, or base64 image data.
name is the display name of the image.
replace( range: object, index?: number )
- Replaces an existing range in this range with the provided new range.
- If
index is not provided, the last range in the collection is replaced.
resize( range: object, index?: number ): boolean
- Resizes an existing range at the given index in collection to the new range.
- If
index is not provided, the last range in the collection is resized.
- A resize occurs only if at least one corner and two edges of the old and new ranges match.
- Returns true when resized, otherwise false.
select()
- Selects all rows or cells within this range., clearing any previous selections.
showCols()
- Shows the columns in this range.
showRows()
- Shows the rows in this range.
style( key: string, val?: string ): string
- Adds a CSS style (key–value pair) to all cells in the range.
- When
val is not provided, returns the CSS style value for the given key from the first cell in the range.
toggleStyle( key: string, val: any[] )
unmerge( refresh?: boolean )
- Unmerges the top-left merged cell, if any, within the range.
valign( str?: string ): string
- Sets the vertical alignment (
"top", "center", or "bottom") for all cells in the range.
- When no parameter is passed, returns the vertical alignment of the first cell in the range.
value( val?: any[] ): any[]
- Gets or sets the values of all cells in the range using a 1-dimensional array.
Setter example:
grid.Range({ r1: 0, c1: 0, rc: 2, cc: 2 }).value(['a', 1, 'b', 2]);
Getter example:
var val = grid.Range({r1:0, c1:0, rc:2, cc:2}).value();
//returns ['a', 1, 'b', 2]
It's used to refresh the whole view of grid after update of records, addition of classes, attributes through JSON or other properties that affect the rows in current page or layout of grid e.g., height, width, etc.
Being a computational intensive operation, if a number of such options / properties of the grid are being updated, this method should be called only once at the end.
Arguments
- header (boolean) — Refresh the header as well. Default:
true.
Code examples:
Invoke the method:
grid.refresh( );
refreshCell( { rowIndx, rowIndxPage, colIndx, dataIndx } )
Refreshes a cell in grid. Either of rowIndx or rowIndxPage and either of dataIndx or colIndx can be provided.
Arguments
- rowIndx (number) — Zero-based index of the row.
- rowIndxPage (number) — Zero-based index of the row on the current page.
- colIndx (number) — Zero-based index of the column.
- dataIndx (number | string) — key name or index in rowData.
Code examples:
Invoke the method:
grid.refreshCell( { rowIndx: 21, dataIndx: 'company' } );
Refreshes colModel in grid.
Arguments
- colModel (Array) — Optional. Replaces the grid’s colModel.
Code examples:
Invoke the method:
grid.refreshCM( );
(v11.1.0) Refreshes the collapse and fullscreen icons.
Code examples:
Invoke the method:
grid.refreshCollapse( );
refreshColumn( { colIndx, dataIndx } )
Refreshes view of whole column in grid. Either of dataIndx or colIndx can be provided.
Arguments
Code examples:
Invoke the method:
grid.refreshColumn( {colIndx:2} );
Refresh the data and view in grid.
It's a superset of refreshView method.
It's useful to refresh View after change in dataModel properties or addition, deletion or update of records.
It also reloads the data when location is 'remote'.
This method being a memory intensive operation should be used judiciously and should be avoided within a loop.
Code examples:
Invoke the method:
grid.refreshDataAndView( );
Refreshes the column headers.
Code examples:
Invoke the method:
grid.refreshHeader( );
refreshHeaderFilter({ colIndx, dataIndx })
Refreshes a single specified header filter, mostly useful to create cascade filtering.
Arguments
Code examples:
Invoke the method:
grid.refreshHeaderFilter({dataIndx: 'ShipRegion'});
refreshRow( { rowIndx, rowIndxPage } )
Refreshes the whole row in grid. Either of rowIndx or rowIndxPage can be provided.
Arguments
Code examples:
Invoke the method:
grid.refreshRow( {rowIndx:21} );
Code examples:
Invoke the method:
grid.refreshSummary( );
It can be used to refresh toolbar when toolbar items are changed after initialization.
Code examples:
Invoke the method:
grid.refreshToolbar( );
Refreshes the view of grid.
It's a superset of refresh method and is useful to refresh the view of grid after change in dataModel properties e.g., sortIndx, sortDir, pageModel options,
addition or deletion of records.
Code examples:
Invoke the method:
grid.refreshView( );
removeAttr( { rowData, rowIndx, dataIndx, attr } )
Removes an attribute from a row or cell previously added with attr method.
Either rowData or rowIndx can be passed.
Arguments
rowData (Object | Array)
Reference to a 1-dimensional array or object representing the row data.
rowIndx (Integer)
Zero-based index of the row.
dataIndx (Integer | String)
Key name or index in rowData.
attr (String)
Name of a single attribute, or a space-separated list of attributes.
Code examples:
Invoke the method:
//Remove title and style attribute from 3rd row.
grid.removeAttr(
{rowIndx: 2, attr: 'title style'}
);
//remove title from 'profits' field in 3rd row.
grid.removeAttr(
{rowIndx: 2, dataIndx: 'profits', attr: 'title'}
);
removeClass( { rowData, rowIndx, dataIndx, cls, refresh } )
Arguments
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
rowIndx: Integer - The zero-based index of the row.
dataIndx: Integer or String - The key name or index in rowData (only required to target a specific cell).
cls: String - One or more class names separated by a space (the CSS classes to be removed).
refresh: Boolean - Optional. Default value is true.
Description
Removes one or more CSS classes (cls) from a specific row or cell in the grid.
- Targeting a Row: To remove classes from an entire row, you must pass either
rowData or rowIndx (but not both), along with the cls.
- Targeting a Cell: To remove classes from a specific cell, you must pass either
rowData or rowIndx along with the cell's unique identifier (dataIndx) and the cls.
- Refresh: By default, the grid is refreshed to show the changes (
refresh: true). Set refresh to false to suppress this immediate refresh.
Code examples:
Invoke the method:
//Remove classes 'pq-delete' & 'pq-edit' from 3rd row.
grid.removeClass(
{rowIndx: 2, cls: 'pq-delete pq-edit'}
);
//remove a class 'pq-delete' from 'profits' field in 3rd row.
grid.removeClass(
{rowIndx: 2, dataIndx: 'profits', cls: 'pq-delete'}
);
removeClassHead( { ri, colIndx } )
Arguments
ri: Integer - The zero-based index of the row in the header (e.g., 0 for the first header row).
cls: String - One or more class names separated by a space (the CSS classes to be removed).
colIndx: Integer - The zero-based index of the column.
Description
Removes one or more CSS classes (cls) from a specified head cell in the grid.
- Scope: This includes standard header cells and cells within the filter row (if present), identified by the row index (
ri) within the header structure and the column index (colIndx).
Code examples:
Invoke the method:
//Remove class from a cell in header.
grid.removeClassHead( {ri: 0, colIndx: 4, cls: 'mycls'} );
//Remove multiple classes from a cell in header filter row
grid.removeClassHead( {ri: 1, colIndx: 3, cls: 'mycls somecls'} );
removeData( { rowData, rowIndx, dataIndx, data } )
Arguments
rowData: Object or Array - A reference to the 1-dimensional array or object representing the row data.
rowIndx: Integer - The zero-based index of the row.
dataIndx: Integer or String - The key name or index in rowData (only required to target a specific cell).
data: String or Array - Optional.
- A string naming the single piece of data to delete.
- An array or space-separated string naming multiple pieces of data to delete.
Description
Removes a previously-stored piece of data (or multiple pieces) from a specific row or cell in the grid.
- Targeting: You must specify the row using either
rowData or rowIndx.
- Row Data: If
dataIndx is omitted, the data is removed from the entire row.
- Cell Data: If
dataIndx is provided, the data is removed only from that specific cell.
- Removal Scope:
- If the optional
data argument is passed, partial removal occurs (only the named data pieces are deleted).
- If the
data argument is not passed, all previously stored data associated with the row or cell is removed.
Code examples:
Invoke the method:
//Remove data with key 'name' from 3rd row.
grid.removeData(
{rowIndx: 2, data: 'name'}
);
//Remove all data from 3rd row.
grid.removeData(
{rowIndx: 2}
);
//remove data with key 'delete' & 'valid' from 'profits' field in 3rd row.
grid.removeData(
{rowIndx: 2, dataIndx: 'profits', data: 'delete valid'}
);
reset( { filter, group, sort } )
Arguments
filter: Boolean - If true, the filter state is reset (cleared).
group: Boolean - If true, the group state is reset (cleared).
sort: Boolean - If true, the sort state is reset (cleared).
Description
This method is used to clear or reset the grid's active state for sorting, filtering, and grouping.
- Usage: You must pass one or more of the boolean parameters set to
true to specify which state(s) should be cleared.
- Example: Calling the method with
{ filter: true, sort: true } would clear all filters and sorting rules, but leave grouping untouched.
Code examples:
Invoke the method:
//resets grouping and filtering in the grid.
grid.reset( { group: true, filter: true } );
Arguments
type: String - Optional. Used to limit the rollback operation to a specific type of change.
- Values: Can be one of:
'add', 'update', or 'delete'.
Description
This method executes an Undo All or Rollback operation for all data manipulation changes (add, edit, and delete) that have occurred since tracking was enabled on the grid.
- Full Rollback: If the optional
type parameter is omitted, the method rolls back all uncommitted additions, edits, and deletions.
(v11.1.0) It fires history event with ui.type = 'rollback'.
- Partial Rollback: If
type is specified (e.g., 'update'), the rollback is limited only to that specific type of operation.
Note that it can leave history in inconsistent state.
Code examples:
Invoke the method:
//rollback all add, update and delete operations.
grid.rollback( );
//rollback delete operations only.
grid.rollback( {type: 'delete'} );
rowCollapse( { rowIndx, rowIndxPage } )
Arguments
rowIndx: Integer - Optional. The zero-based index of the row (global index).
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page (page-specific index).
Description
This method collapses (hides) the detail view (e.g., a secondary sub-grid or expanded content area) associated with a specific row.
- Targeting: You must identify the row by providing either
rowIndx OR rowIndxPage.
- Purpose: Programmatically closes an expanded row detail panel, typically used for managing hierarchical or extra information within the grid.
Code examples:
Invoke the method:
grid.rowCollapse( {rowIndx:21} );
rowExpand( { rowIndx, rowIndxPage } )
Arguments
rowIndx: Integer - Optional. The zero-based index of the row (global index).
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page (page-specific index).
Description
This method expands (shows) the detail view associated with a specific row. The detail view typically contains extra information or a secondary component (like another grid) that is visually placed beneath the main row.
- Targeting: You must identify the row by providing either
rowIndx OR rowIndxPage.
- Purpose: Programmatically opens an expanded row detail panel.
Code examples:
Invoke the method:
grid.rowExpand( {rowIndx:21} );
rowInvalidate( { rowIndx, rowIndxPage } )
Arguments
rowIndx: Integer - Optional. The zero-based index of the row (global index).
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page (page-specific index).
Description
This method removes the detail view associated with a specific row completely from both the visible view and the internal cache.
- Targeting: You must identify the row by providing either
rowIndx OR rowIndxPage.
- Purpose: It is particularly useful when the detail view fails to load correctly (e.g., due to a network error) and needs to be cleared out so it can be reloaded properly later.
Code examples:
Invoke the method:
grid.rowInvalidate( {rowIndx:21} );
Saves the currently edited cell. It's internally used by the grid whenever the cell is saved during inline editing.
It participates in tracking for commit and rollback when tracking is on.
It can be useful to invoke in custom editors.
It fires two events i.e., cellBeforeSave]] and cellSave]].
It aborts the save operation and returns false if cellBeforeSave]] returns false. cellSave]] event is not fired when save operation is unsuccessful.
It fires cellSave event and returns true when save operation is successful.
It returns null if no cell is being edited.
Code examples:
Invoke the method:
//saves the edited cell
var success = grid.saveEditCell( );
saveState( { extra, save, stringify } )Returns: String
Arguments
extra: PlainObject - Optional. An object containing extra data to be saved along with the grid state.
save: Boolean - Optional. Default value is true. If set to false, the state is not saved to the browser's local storage.
stringify: Boolean - Optional. Default value is true. If set to false, the state object is not converted to a JSON string and is also not saved to local storage.
Description
This method saves the current configuration state of the grid and returns the state as a string.
- Saving Location: By default, the state is saved as a string in the browser's local storage. This action can be suppressed by setting
save: false.
- Returned Value: The state is also returned as a string (unless
stringify is false), allowing it to be saved elsewhere, such as in a database.
- Scope of Saved State: The amount and type of state saved (e.g., column order, widths, filtering, sorting, and paging) is determined by the global options
stateKeys and stateColKeys.
- (v10.0.0) The state of grouped columns is also included in the saved state.
Important Note
The main data of the grid is NOT saved in the state string; only the structural and functional settings are saved.
Code examples:
Invoke the method:
//save the current state of grid.
var state = grid.saveState( );
scrollCell( { rowIndx, rowIndxPage, colIndx, dataIndx }, fn? )
Arguments
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page.
colIndx: Integer - Optional. The zero-based index of the column.
dataIndx: Integer or String - Optional. The key name or index in rowData.
fn: Function - Optional. A callback function to be executed once the scrolling is complete.
Description
This method scrolls the grid's view horizontally and/or vertically (if necessary) to make a specific cell visible within the viewport.
- Targeting: You must identify the row using either
rowIndx (implied, but rowIndxPage is listed) OR rowIndxPage, and identify the column using either colIndx OR dataIndx.
- Callback: If the optional function
fn is provided, it is executed after the grid has finished scrolling and the target cell is visible.
Code examples:
Invoke the method:
grid.scrollCell( { rowIndx: 2, dataIndx: "lastname" } );
scrollColumn( { colIndx, dataIndx }, fn? )
Arguments
colIndx: Integer - Optional. The zero-based index of the column (column position).
dataIndx: Integer or String - Optional. The key name or index in rowData (column identifier).
fn: Function - Optional. A callback function to be executed once the horizontal scrolling is complete.
Description
This method scrolls the grid's view horizontally (if needed) to ensure that the specified column is visible within the viewport.
- Targeting: You must identify the column by providing either
colIndx OR dataIndx.
- Callback: If the optional function
fn is provided, it is executed after the grid has finished scrolling and the target column is visible.
Code examples:
Invoke the method:
grid.scrollColumn( { dataIndx: "lastname" } );
scrollRow( { rowIndxPage }, fn? )
Arguments
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page.
fn: Function - Optional. A callback function to be executed once the vertical scrolling is complete.
Description
This method scrolls the grid's view vertically (if necessary) to ensure that the specified row is visible within the viewport.
- Targeting: The row is identified using the
rowIndxPage parameter.
- Callback: If the optional function
fn is provided, it is executed after the grid has finished scrolling and the target row is visible.
Code examples:
Invoke the method:
grid.scrollRow( { rowIndxPage: 30 } );
Arguments
x: Integer - Optional. The target scroll position value in pixels (where the grid should scroll to horizontally).
fn: Function - Optional. A callback function to be executed once the horizontal scrolling is complete.
Description
This method controls the horizontal scroll position of the grid's viewport.
- Set Scroll Position: If the
x parameter is passed, the method scrolls the view horizontally to that position (in pixels).
- Get Scroll Position: If no parameters are passed, the method returns the current horizontal scroll position (in pixels).
- Callback: The optional function
fn is executed after the scroll operation has completed.
Code examples:
Invoke the method:
grid.scrollX( 200 );
Arguments
x: Integer - Optional. The target horizontal scroll position value in pixels.
y: Integer - Optional. The target vertical scroll position value in pixels.
fn: Function - Optional. A callback function to be executed once the scrolling is complete.
Description
This method programmatically scrolls the grid's view to a given horizontal (x) and/or vertical (y) position, if scrolling is required to reach that coordinate.
- Purpose: Allows precise control over the grid's viewport scroll position.
- Callback: The optional function
fn is executed after the scroll operation has fully completed.
Code examples:
Invoke the method:
grid.scrollXY( 100, 200 );
Arguments
y: Integer - Optional. The target scroll position value in pixels (where the grid should scroll to vertically).
fn: Function - Optional. A callback function to be executed once the vertical scrolling is complete.
Description
This method controls the vertical scroll position of the grid's viewport.
- Set Scroll Position: If the
y parameter is passed, the method scrolls the view vertically to that position (in pixels).
- Get Scroll Position: If no parameters are passed, the method returns the current vertical scroll position (in pixels).
- Callback: The optional function
fn is executed after the scroll operation has completed.
Code examples:
Invoke the method:
grid.scrollY( 200 );
search( { row, first } )Returns: Array
Arguments
first: Boolean - Optional. If true, the search will stop and return only the first match found.
row: Object - An object containing one or more field names and their corresponding values (e.g., { dataIndx: value, anotherDataIndx: anotherValue }) to use as the search criteria.
Description
This method is used to search for one or more fields (columns) within the grid's rows that match the values provided in the row object.
- Returns: An array of objects containing the index and data for all matching rows:
{ rowIndx: number, rowData: object/array }
- First Match: If the
first parameter is set to true, the method returns only the information for the very first matching row encountered.
Code examples:
Invoke the method:
//search row with id: 5
var rowList = grid.search( {
row: { id : 5 }
});
var rowIndx = rowList.rowIndx;
Returns Selection instance that represents all the selected rectangular regions in a grid. Every grid has a unique Selection instance.
var Sel = grid.Selection();
Selection inherits all functionality and methods of Range object.
Instance methods
getSelection()
isSelected(rowIndx, colIndx?, dataIndx?)
removeAll()
- Deselects all selected rectangular regions in the grid.
Example:
Sel.removeAll();
selectAll(all?: boolean)
Code examples:
Invoke the method:
//merge all cells lying within selection by calling merge method inherited from Range.
grid.Selection().merge();
Returns row selection instance. Also see selectionModel options.
beforeRowSelect and rowSelect events are fired during selection/ unselection process.
var sel = grid.SelectRow();
Instance methods
add(rowIndx?: number, isFirst?: boolean, rows?: [{rowIndx: number}])
- Adds one or more row selections.
//add 3rd row to selection
sel.add( {rowIndx: 2});
//add 2nd, 3rd & 7th row to selection
sel.add(rows: [ { rowIndx: 1 },{ rowIndx: 2}, {rowIndx: 6} ] });
extend(rowIndx: number)
- Extends selection from the first row (set using
isFirst parameter of the add method) to the passed rowIndx.
getFirst()
- Gets the first row selection.
getSelection()
- Gets all row selections.
- Returns an array of plain objects containing
rowIndx, rowData properties.
//Get all row selections
var selectionArray = sel.getSelection();
//returns [{rowIndx: number, rowData: rowData}..]
isSelected(rowIndx: number)
- Returns
true/false or null depending upon the selection state of the row.
//Find whether 3rd row is selected.
var isSelected = sel.isSelected({rowIndx: 2 });
remove( rowIndx?: number, rows?: [{rowIndx: number}] )
- Removes one or more row selections.
//removes 10th row from selection.
sel.remove({rowIndx: 9});
//remove 2nd, 3rd & 7th row from selection
sel.remove({rows: [ { rowIndx: 1 },{ rowIndx: 2}, {rowIndx: 6} ] });
removeAll(all: boolean)
- Removes all selections on the current page or all pages when
all is true.
//remove all row selections
sel.removeAll();
replace(rowIndx?: number, isFirst?: boolean, rows?: [{rowIndx: number}])
- Replaces all previous row selections with one or more new row selections.
selectAll(all: boolean)
- Selects all rows on the current page or all pages when
all is true.
setFirst(rowIndx: number)
- Sets this row as the first selection.
toggle(rowIndx: number, isFirst?: boolean)
- Selects an unselected row or unselects a selected row.
setData( data: Object[ ] )
Arguments
data: Array - An Array of plain objects (the new row data) to be loaded into the grid.
Description
This method is used to set new data into the grid.
- Action: It effectively replaces the grid's existing data with the data provided in the
data array.
- Format: The data must be an array where each element is an object representing a row/record.
Code examples:
Invoke the method:
grid.setData( [ ] );
setSelection( { rowIndx, rowIndxPage, colIndx, focus}, fn? )
Arguments
rowIndx: Integer - Optional. The zero-based index of the row (global index).
rowIndxPage: Integer - Optional. The zero-based index of the row on the current page.
colIndx: Integer - Optional. The zero-based index of the column.
focus: Integer - Optional. Default value is true. If set to false, the row/cell will be selected but not focused.
fn: Function - Optional. A callback function to be executed after scrolling (if any) is complete.
Description
Selects a specific row or cell based on the parameters provided.
Key Behaviors
- Selection:
- To select a row, provide either
rowIndx or rowIndxPage.
- To select a cell, provide a row index (e.g.,
rowIndx) and colIndx.
- Deselection: If
null is passed as a parameter (e.g., grid.select(null)), the method deselects everything in the grid.
- Visibility & Focus:
- If the target cell or row is outside the visible area, the grid scrolls to bring it into the viewport.
- By default (
focus: true), the grid sets focus on the selected row or cell. This can be suppressed by setting focus: false.
- Callback: If an optional function
fn is provided, it is executed once any necessary scrolling has been completed.
Code examples:
Invoke the method:
//select 3rd row
grid.setSelection( {rowIndx:2} );
//select cell in 10th row and 4th column.
grid.setSelection( {rowIndx: 9,colIndx: 3} );
//deselect everything.
grid.setSelection( null );
Displays the loading icon in center of the grid. It is useful while asynchronous operations are in progress.
Code examples:
Invoke the method:
grid.showLoading( );
sort( { single, sorter } )
Arguments
single: Boolean - Optional. Default value is sortModel.single.
- Purpose: If
true, applying a new sort rule will replace any existing rules (single-column sorting). If false, new rules are added to existing ones (multi-column sorting).
skipCustomSort: Boolean - Optional.
- Purpose: If
true, the method will skip any custom sorting logic, typically used by features like row grouping. This behavior is automatically triggered when a user performs a multi-sort action (e.g., pressing Ctrl/Meta key while clicking a column header).
sorter: Array - Optional. Default value is sortModel.sorter.
- Purpose: An array of objects defining the sort criteria (e.g.,
[{ dataIndx: 'colA', dir: 'asc' }]).
Description
This method is used to sort the data within the grid. The sorting behavior is largely determined by the sortModel options (which describe the format and properties of the parameters).
Key Behaviors
- Refresh Sorting: When called with no parameters, the method simply re-applies (refreshes) the existing sorting rules stored in the grid's
sortModel.
- New Sorting/Multi-Sort: When parameters are passed, the grid applies the new sorting based on the
sorter array and the single flag.
- Remove All Sorting: To completely remove all current sorting from the grid, pass an empty array (
[]) for the sorter parameter.
Code examples:
Invoke the method:
grid.sort( {
sorter: [ { dataIndx: 'products', dir: "up" } ]
});
Tab( methodName?: string, ...methodArgs: any[] )
📑 Tab Module Interface (Tab())
Tab(methodName?: string, ...methodArgs: any[])
Arguments
methodName?: string: (Optional) The name of the method to be executed on all created grid instances.
...methodArgs: any[]: (Optional) The arguments to be passed to the methodName.
Description
- Returns the Tab Instance when called without any parameter. This module is responsible for manipulating tabs/sheets UI.
- Cross-Grid Invocation (v10.1.0): Can be used to invoke methods on all created grids. The first parameter is the method name (string), and subsequent parameters are the arguments for that method.
- Special Case:
option Method: The option method updates the option for all grids, including uninitialized grids.
- Note: A Tab grid is the specific grid instance corresponding to a tab/sheet.
Examples
//update options in all grids.
grid.Tab( 'option', 'localeFmt', 'en-US' );
//call refreshDataAndView on all created grid instances.
grid.Tab( 'refreshDataAndView' );
Instance methods
Test: What's the difference between grid.Tab( 'refresh' ) and grid.Tab().refresh()
Toggles the grid between maximized or fullscreen or full viewport state and normal state.
Code examples:
Invoke the method:
grid.toggle( );
toolbar( selector )Returns: jQuery
Arguments
selector: string - Optional. A CSS selector used to find a specific element or set of elements within the toolbar.
Description
This method is used to retrieve the grid's toolbar DOM node or to find specific element(s) inside it.
- No Selector: When the
selector parameter is omitted, the method returns the entire toolbar DOM node (the main container element) wrapped in a jQuery object.
- With Selector: When a
selector is passed, the method searches for and returns the corresponding element(s) found within the toolbar, also wrapped in a jQuery object.
Code examples:
Invoke the method:
var $toolbar = grid.toolbar( );
Returns toolpanel instance.
Instance methods
hide()
isVisible()
- Returns
true/false depending upon visibility of toolPanel.
show()
- Shows the toolPanel.
- Example:
grid.ToolPanel().show()
toggle()
- Toggles visibility of toolPanel.
Returns treegrid instance. Also see treeModel options.
var Tree = grid.Tree();
Word "Node" is being used in the Tree API which is same as rowData. Nodes contain some meta data:
pq_level: Level of the node beginning from root level nodes having pq_level = 0.
pq_close: collapsed/expanded state of a parent node expressed as truthy/falsey values.
Any node which contains non null value of pq_close or children property is considered a parent node.
Instance methods
addNodes(nodes: any[], parent?: any, indx?: number)
- Adds new nodes to the treegrid. New nodes must be in flat format and contain
id and parentId properties. If nodes have a common parent but lack parentId, the second parameter (parent node) must be passed. The indx parameter supports inserting new nodes at a specific index; nodes are appended if indx is omitted. Undo is supported (ui.source = "addNodes").
Examples:
// Nodes specifying parentId
Tree.addNodes( [
{ id: 100, parentId: 1, ... },
{ id: 101, parentId: 1, ... },
{ id: 102, parentId: 100, ... },
] );
// Nodes specifying parent node object
Tree.addNodes( [
{ id: 100, ... },
{ id: 101, ... },
], Tree.getNode(1) );
// Add root nodes (no parent specified)
Tree.addNodes( [
{ id: 100, ... },
{ id: 101, ... },
] );
checkAll()
- Checks all checkboxes. Fires
beforeCheck and check events.
checkNodes(nodes: any[])
- Checks the specified nodes. Fires
beforeCheck and check events.
collapseAll()
- Collapses all tree nodes. Fires
beforeTreeExpand and treeExpand events.
collapseNodes(nodes: any[])
- Collapses one or more specified tree nodes. Fires
beforeTreeExpand and treeExpand events.
Examples:
// collapse nodes by ID
Tree.collapseNodes( [
Tree.getNode( 1 ),
Tree.getNode( 5 )
] );
// collapse nodes by rowIndx
Tree.collapseNodes( [
grid.getRowData( {rowIndx: 1} ),
grid.getRowData( {rowIndx: 3} )
] );
deleteNodes(nodes: any[])
- Removes the specified nodes. Undo is supported (
ui.source = "deleteNodes").
eachChild(node: any, cb: (node: any, parent: any) => void)
eachParent(node: any, cb: (node: any) => void)
expandAll()
- Expands all tree nodes. Fires
beforeTreeExpand and treeExpand events.
Example:
grid.Tree().expandAll();
expandNodes(nodes: any[])
expandTo(node: any)
getCheckedNodes()
getChildren(node: any)
- Returns an array containing the children nodes of a passed node. Returns root nodes when
node is not passed.
getChildrenAll(node: any)
- Returns an array containing all the children, grandchildren (and so on) nodes of a passed node.
getLevel(node: any)
getNode(id: number | string)
getParent(node: any)
getRoots()
getSummary(node)
isAncestor(childNode, ancestorNode)
isCollapsed(node: any)
isFolder(node: any)
isHeadChecked()
- Returns
true, false, or null (indeterminate state) depending upon the checkbox state in the header cell.
isOn()
- Returns
true if the treegrid is created.
moveNodes(nodes: any[], parent?: any, indx?: number)
option(options: Object)
unCheckAll()
- Unchecks all checkboxes. Fires
beforeCheck and check events.
unCheckNodes(nodes: any[])
- Unchecks the specified nodes. Fires
beforeCheck and check events.
updateId(node: any, id: number | string)
- Updates the id of a node with a new id passed as the 2nd parameter.
(v9.0.0) This method removes any frozen panes.
Code examples:
Invoke the method:
grid.unfreezePanes();
updateRow( { rowIndx, newRow, rowList, track, source, history, checkEditable, refresh } )
Updates one or more fields in a row or mutliple rows.
Arguments
rowIndx (Integer)
Zero-based index of the row.
newRow (Object)
Object containing the modified data for single row.
v11.0.0: Rich objects or normal cells with attributes, properties and style can be passed instead of primitive values in an object format.
{ val, attr, prop, style }
rowList (Array)
Array of objects in the form { rowIndx, newRow }.
Used for multiple rows.
checkEditable (Boolean)
Optional. Default is true.
Checks the editability of the row and its cells.
history (Boolean)
Optional. Default is historyModel.on.
Determines whether this operation is added to the history.
refresh (Boolean)
Optional. Default is true.
If false, the view is not refreshed.
source (String)
Optional. Default is 'update'.
Value is available in the beforeValidate and change event
track (Boolean)
Optional. Default is trackModel.on.
beforeValidate and change events are fired by this method.
Code examples:
Invoke the method:
//update single row.
grid.updateRow( {
rowIndx: 2,
newRow: { ProductName: 'Cheese', UnitPrice: 30 }
});
//update multiple rows at once.
grid.updateRow( {
rowList: [
{ rowIndx: 2, newRow: { ProductName: 'Cheese', UnitPrice: 30 }},
{ rowIndx: 5, newRow: { ProductName: 'Butter', UnitPrice: 25 }}
]
});
//v11.0.0: add rich objects or rich styles to the row.
grid1.updateRow({
rowIndx: 1,
newRow: {
//rich object cell with style
ProductName: {
val: 'ParamQuery API',
prop: {
inst: 'Link', //this makes it rich object.
link: '../api'
},
style: {
background: "#ff9999"
}
},
//ordinary cell with attr, prop & style
UnitPrice: {
val: 30,
attr:{
title: "This is a rich cell with style and attr"
},
prop:{
format: '#0.00',
align: 'center'
},
style: {
'border-top': "3px dotted #ff9999",
'font-style': "italic"
}
}
}
})
Returns a jQuery object containing the grid.
Code examples:
Invoke the method:
var widget = grid.widget( );
autoRowHeight( event, ui )Type: pqGrid:autoRowHeight
Fired when the auto height calculation of all rows currently visible in the viewport is complete.
Callback arguemnts
Code examples:
Initialize the pqGrid with the autoRowHeight callback specified:
pq.grid( selector,{
autoRowHeight: function( event, ui ) {}
});
beforeCellClick( event, ui )Type: pqGrid:beforeCellClick
- Description:
- Triggered when a cell is clicked, but before any default action (like selection, navigation, or editing) is taken by the grid.
- The default action of the grid can be prevented by returning
false from this event handler.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column in colModel.
Code examples:
Initialize the pqGrid with the beforeCellClick callback specified:
pq.grid( selector,{
beforeCellClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeCellClick event:
grid.on( "beforeCellClick", function( event, ui ) {} );
beforeCellKeyDown( event, ui )Type: pqGrid:beforeCellKeyDown
- Description:
- Triggered when a key is pressed in a currently focused cell, but before any default key navigation action is taken by the grid.
- This event allows for custom handling of keys (e.g.,
LEFT, RIGHT, UP, DOWN, PAGE_UP, PAGE_DOWN, DELETE, etc.) within the grid interface.
- The default key action of the grid can be prevented by returning
false from this event handler.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column in colModel.
Code examples:
Initialize the pqGrid with the beforeCellKeyDown callback specified:
pq.grid( selector,{
beforeCellKeyDown: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeCellKeyDown event:
grid.on( "beforeCellKeyDown", function( event, ui ) {} );
beforeCheck( event, ui )Type: pqGrid:beforeCheck
Triggered before checkbox is checked or unchecked in a checkbox column, treegrid
or row grouping with checkboxes.
It can be canceled by returning false.
In case of treegrid and row grouping with cascade checkboxes, only the directly affected nodes are present in rows.
Indirectly affected nodes can be found by [[eachChild]] and [[eachParent]] methods of Grid/Tree.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- check
Type:
Boolean
state of the checkbox.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- rows
Type:
Array
Collection of row objects having rowIndx, rowData.
Code examples:
Initialize the pqGrid with the beforeCheck callback specified:
pq.grid( selector,{
beforeCheck: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeCheck event:
grid.on( "beforeCheck", function( event, ui ) {} );
beforeColAdd( event, ui )Type: pqGrid:beforeColAdd
(v7.0.0) Triggered before new columns are added in the grid.
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
arguemnts passed to Columns().add method.
Code examples:
Initialize the pqGrid with the beforeColAdd callback specified:
pq.grid( selector,{
beforeColAdd: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeColAdd event:
grid.on( "beforeColAdd", function( event, ui ) {} );
beforeColMove( event, ui )Type: pqGrid:beforeColMove
(v7.1.0) Triggered before columns are moved within the grid through
[[Columns().move]] method.
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
Arguments to Columns().move method.
Code examples:
Initialize the pqGrid with the beforeColMove callback specified:
pq.grid( selector,{
beforeColMove: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeColMove event:
grid.on( "beforeColMove", function( event, ui ) {} );
beforeColRemove( event, ui )Type: pqGrid:beforeColRemove
(v7.0.0) Triggered before columns are removed from the grid.
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
arguemnts passed to Columns().remove method.
Code examples:
Initialize the pqGrid with the beforeColRemove callback specified:
pq.grid( selector,{
beforeColRemove: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeColRemove event:
grid.on( "beforeColRemove", function( event, ui ) {} );
beforeColumnCollapse( event, ui )Type: pqGrid:beforeColumnCollapse
Triggered before a grouped column is collapsed or expanded.
Current collapsed state of affected column can be obtained from
[[ui.column.collapsible.on]].
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- column
Type:
Object
Object containing properties of this column.
Code examples:
Initialize the pqGrid with the beforeColumnCollapse callback specified:
pq.grid( selector,{
beforeColumnCollapse: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeColumnCollapse event:
grid.on( "beforeColumnCollapse", function( event, ui ) {} );
beforeCopy( event, ui )Type: pqGrid:beforeCopy
(v8.4.0) Triggered before a range of cells are copied from grid. [[ui.areas]] can be modified in this event.
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- areas
Type:
array
Array of address objects having r1, r2, c1, c2 properties.
Code examples:
Initialize the pqGrid with the beforeCopy callback specified:
pq.grid( selector,{
beforeCopy: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeCopy event:
grid.on( "beforeCopy", function( event, ui ) {} );
beforeExport( event, ui )Type: pqGrid:beforeExport
Triggered before data is exported.
It can be used to show/hide the necessary rows/columns in the exported data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the beforeExport callback specified:
pq.grid( selector,{
beforeExport: function( event, ui ) {}
});
beforeFillHandle( event, ui )Type: pqGrid:beforeFillHandle
Triggered before a square box is about to be displayed at bottom right corner of a range selection.
It can be cancelled by returning false. This event is added in v3.4.0.
The coordinates of the cell i.e., rowIndx, rowIndxPage, rowData, column, colIndx, dataIndx are
passed through ui argument to this event.
Callback arguemnts
Code examples:
Initialize the pqGrid with the beforeFillHandle callback specified:
pq.grid( selector,{
beforeFillHandle: function( event, ui ) {
if( ui.column.dataType == 'float' ){//disable fillHandle for float columns.
return false;
}
else if( ui.dataIndx == "company" ){
this.option( 'fillHandle', 'vertical' );//only vertical dragging.
}
}
});
beforeFilter( event, ui )Type: pqGrid:beforeFilter
Triggered before data is filtered.
The structure of [[ui]] object is same as parameters passed to the filter method.
Please refer to filter method for details.
Callback arguemnts
Code examples:
Initialize the pqGrid with the beforeFilter callback specified:
pq.grid( selector,{
beforeFilter: function( event, ui ) {}
});
beforeGroupExpand( event, ui )Type: pqGrid:beforeGroupExpand
Triggered before a grouped cell, whole level or all levels are expanded/collapsed.
It can be cancelled by returning false. This event is added in v3.3.5.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- close
Type:
Boolean
collapsed state.
- all
Type:
Boolean
true when all group levels are affected, undefined otherwise.
- level
Type:
Integer
grouping level.
- group
Type:
String
grouping title when a single cell is affected, undefined otherwise.
Code examples:
Initialize the pqGrid with the beforeGroupExpand callback specified:
pq.grid( selector,{
beforeGroupExpand: function( event, ui ) {}
});
beforeHeadKeyDown( event, ui )Type: pqGrid:beforeHeadKeyDown
(v8.7.0) Triggered before default action is taken when any key is pressed in a focused header cell. Default action can be prevented by returning false.
| key | Default action |
| --- | --- |
| [[ENTER]] | Toggles the sort state of corresponding column
Toggles the collapsed state of grouped column
Sets focus on first focusable control in the cell in case of header filter row
Toggles the state between (collapse all/expand all) in case of detail view
|
| [[CTRL + ENTER]] | Open popup menu attached to the cell |
| [[SPACE]] | Toggles the checkbox state in cell |
| [[LEFT]] | Moves focus to left cell, stops at the edge |
| [[RIGHT]] | Moves focus to right cell, stops at the edge |
| [[TAB]] | Moves focus to right cell in default layout and to left cells in RTL layout.
Moves focus to next focusable elemet in the document when it reaches the edge.
|
| [[SHIFT + TAB]] | Moves focus in opposite direction to that in case of [[TAB]] alone |
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- ri
Type:
number
Zero based index of row
- colIndx
Type:
number
Zero based index of column
Code examples:
Initialize the pqGrid with the beforeHeadKeyDown callback specified:
pq.grid( selector,{
beforeHeadKeyDown: function( event, ui ) {}
});
beforeHideCols( event, ui )Type: pqGrid:beforeHideCols
Triggered before columns are hidden or displayed via header menu or API (new in v5.2.0).
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- diHide
Type:
Array
Array of dataIndx of columns being hidden.
- diShow
Type:
Array
Array of dataIndx of columns being displayed.
Code examples:
Initialize the pqGrid with the beforeHideCols callback specified:
pq.grid( selector,{
beforeHideCols: function( event, ui ) {}
});
beforeNewData( event, ui )Type: pqGrid:beforeNewData
(v8.6.0) Triggered before new data is assigned to grid or before fetching remote data.
It's generally fired during initialization or when refreshDataAndView method is invoked in grid.
Callback arguemnts
Code examples:
Initialize the pqGrid with the beforeNewData callback specified:
pq.grid( selector,{
beforeNewData: function( event, ui ) {}
});
beforePaste( event, ui )Type: pqGrid:beforePaste
Triggered before data is pasted into the grid, pasted data can be modified in this event. For example when formatted numbers are pasted, this event can extract pure integers and float values from them.
Return false cancels the paste operation.
[[pq.deFormatNumber]] method may be used instead of regular expression if exact format of the pasted values is known.
[[pq.parseDate]] and [[pq.formatDate]] can be used to extract dates from formatted date strings.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- areas
Type:
Array
rectangular regions affected by paste.
- rows
Type:
Array
Array of rows being pasted.
Code examples:
Initialize the pqGrid with the beforePaste callback specified:
beforePaste: function(evt, ui){
//sanitize pasted data.
var CM = this.getColModel(),
rows = ui.rows,
area = ui.areas[0],
c1 = area.c1;
for(var i=0; i < rows.length; i++){
var row = rows[i];
for(var j=0; j < row.length; j++){
var column = CM[j+c1],
dt = column.dataType;
if( dt == "integer" || dt == "float" ){
row[j] = row[j].replace(/[^(\d|\.)]/g,"");
}
}
}
},
beforeRowExpand( event, ui )Type: pqGrid:beforeRowExpand
Triggered before row detail is expanded or collapsed.
It can be canceled by returning false.
Event is fired for row collapse since v5.5.0
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- close
Type:
Boolean
True when row is collapsed ( new in v5.5.0).
Code examples:
Initialize the pqGrid with the beforeRowExpand callback specified:
pq.grid( selector,{
beforeRowExpand: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeRowExpand event:
grid.on( "beforeRowExpand", function( event, ui ) {} );
beforeRowSelect( event, ui )Type: pqGrid:beforeRowSelect
Triggered before rows are selected or unselected.
It's cancelled when false is returned.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- addList
Type:
Array
Array of selected rows { rowIndx: rowIndx, rowData: rowData }
- deleteList
Type:
Array
Array of unselected rows { rowIndx: rowIndx, rowData: rowData }
Code examples:
Initialize the pqGrid with the beforeRowSelect callback specified:
pq.grid( selector,{
beforeRowSelect: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeRowSelect event:
grid.on( "beforeRowSelect", function( event, ui ) {} );
beforeSort( event, ui )Type: pqGrid:beforeSort
Triggered before data is sorted. Sorting can be canceled by returning false. See sortModel option for description of various ui properties.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- single
Type:
Boolean
multiple column sorting when false. Available since v3.0.0
- oldSorter
Type:
Array
An array of objects having dataIndx and dir providing previous sorting information. Available since v3.0.0
- sorter
Type:
Array
An array of objects having dataIndx and dir. Available since v3.0.0
Code examples:
Initialize the pqGrid with the beforeSort callback specified:
pq.grid( selector,{
beforeSort: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeSort event:
grid.on( "beforeSort", function( event, ui ) {} );
beforeTableView( event, ui )Type: pqGrid:beforeTableView
Triggered just before grid is about to display or render the data.
Any last moment changes can be done in the data during this event. It can be used only to update the records
and should not insert or delete records.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- pageData
Type:
Array
2-dimensional array or JSON data for current page.
- initV
Type:
Integer
Index of first new rendered row in the unfrozen viewport.
- finalV
Type:
Integer
Index of last new rendered row in the unfrozen viewport.
- initH
Type:
Integer
Index of first new rendered column in the unfrozen viewport.
- finalH
Type:
Integer
Index of last new rendered column in the unfrozen viewport.
Code examples:
Initialize the pqGrid with the beforeTableView callback specified:
pq.grid( selector,{
beforeTableView: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeTableView event:
grid.on( "beforeTableView", function( event, ui ) {} );
beforeTreeExpand( event, ui )Type: pqGrid:beforeTreeExpand
Triggered before tree nodes are either collapsed or expanded.
It can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- nodes
Type:
Array
Array of rows (rowData) being affected.
- close
Type:
Boolean
true when collapse and false when expand.
Code examples:
Initialize the pqGrid with the beforeTreeExpand callback specified:
pq.grid( selector,{
beforeTreeExpand: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeTreeExpand event:
grid.on( "beforeTreeExpand", function( event, ui ) {} );
beforeValidate( event, ui )Type: pqGrid:beforeValidate
Triggered before change in grid data takes place due to:
- inline editing a cell
- add, update, delete rows
- paste of rows/cells, undo, redo
Checks for editability of row/cell and validations take place between [[beforeValidate]] and [[change]] events. All ui arguments are passed by reference so any modification to the arguments affects subsequent data processing by the grid.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- addList
Type:
Array
Array of added rows { rowIndx: rowIndx, newRow: newRow }
- updateList
Type:
Array
Array of updated rows { rowIndx: rowIndx, rowData: rowData, newRow: newRow, oldRow: oldRow }
- deleteList
Type:
Array
Array of deleted rows { rowIndx: rowIndx, rowData: rowData }
- source
Type:
String
origin of the change e.g., 'edit', 'update', 'add' , 'delete', 'paste', 'undo', 'redo' or a custom source passed to addRow, updateRow, deleteRow methods.
- allowInvalid
Type:
Boolean
Allows invalid value and adds an invalid class to the cell/cells.
- history
Type:
Boolean
Whether add this operation in history.
- checkEditable
Type:
Boolean
Checks whether the row/cell is editable before making any change.
Code examples:
Initialize the pqGrid with the beforeValidate callback specified:
pq.grid( selector,{
beforeValidate: function( event, ui ) {}
});
Bind an event listener to the pqGrid:beforeValidate event:
grid.on( "beforeValidate", function( event, ui ) {} );
blur( event, ui )Type: pqGrid:blur
(v8.7.0) Triggered when focus moves from grid body to some other element in the same document.
Callback arguemnts
Code examples:
Initialize the pqGrid with the blur callback specified:
pq.grid( selector,{
blur: function( event, ui ) {}
});
blurHead( event, ui )Type: pqGrid:blurHead
(v8.7.0) Triggered when focus moves from grid header to some other element in the same document.
Callback arguemnts
Code examples:
Initialize the pqGrid with the blurHead callback specified:
pq.grid( selector,{
blurHead: function( event, ui ) {}
});
cellBeforeSave( event, ui )Type: pqGrid:cellBeforeSave
Triggered before a cell is saved in grid during inline editing.
Saving of data can be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowIndx
Type:
Integer
Zero based index of the row corresponding to cell.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- newVal
Type:
Object
New value inside the editor.
Code examples:
Initialize the pqGrid with the cellBeforeSave callback specified:
pq.grid( selector,{
cellBeforeSave: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellBeforeSave event:
grid.on( "cellBeforeSave", function( event, ui ) {
var dataIndx = ui.dataIndx, newVal = ui.newVal;
if(dataIndx == 'profits'){
if(newVal < 0){
return false;
}
}
});
cellClick( event, ui )Type: pqGrid:cellClick
Triggered when a cell is clicked in grid
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column corresponding to clicked cell.
Code examples:
Initialize the pqGrid with the cellClick callback specified:
pq.grid( selector,{
cellClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellClick event:
grid.on( "cellClick", function( event, ui ) {} );
cellDblClick( event, ui )Type: pqGrid:cellDblClick
Triggered when a cell is double clicked in grid
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column in colModel.
Code examples:
Initialize the pqGrid with the cellDblClick callback specified:
pq.grid( selector,{
cellDblClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellDblClick event:
grid.on( "cellDblClick", function( event, ui ) {} );
cellKeyDown( event, ui )Type: pqGrid:cellKeyDown
Triggered when a key is pressed in a selected cell.
In case of multiple cell selection, the last selected cell receives the keys input.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column in colModel.
Code examples:
Initialize the pqGrid with the cellKeyDown callback specified:
pq.grid( selector,{
cellKeyDown: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellKeyDown event:
grid.on( "cellKeyDown", function( event, ui ) {} );
cellRightClick( event, ui )Type: pqGrid:cellRightClick
(v7.2.0) This event is deprecated and replaced by context event
Triggered when context menu is activated for a cell, which is right click on desktops and long tap in touch devices. Inbuilt context menu of browser is not opened if the event handler returns false.
(v6.0.0) Event is also fired on number cell.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row corresponding to cell.
- colIndx
Type:
Integer
Zero based index of the column in colModel, is -1 in case of number cell.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- $td
Type:
jQuery
jQuery wrapper on cell.
Code examples:
Initialize the pqGrid with the cellRightClick callback specified:
pq.grid( selector,{
cellRightClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellRightClick event:
grid.on( "cellRightClick", function( event, ui ) {} );
cellSave( event, ui )Type: pqGrid:cellSave
Triggered after a cell is saved in grid locally due to inline editing.
This event is suitable to update computed or dependent data in other cells.
If you want to make your code execute after data changes irrespective of the reason i.e., inline editing,
copy/paste, etc. please use change event which is more versatile than this event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column.
Code examples:
Initialize the pqGrid with the cellSave callback specified:
pq.grid( selector,{
cellSave: function( event, ui ) {}
});
Bind an event listener to the pqGrid:cellSave event:
grid.on( "cellSave", function( event, ui ) {} );
change( event, ui )Type: pqGrid:change
Triggered after change in grid data takes place due to:
- inline editing a cell
- add, update, delete rows
- paste of rows/cells, undo, redo
Checks for editability of row/cell and validations take place between [[beforeValidate]] and [[change]] events. This event is suitable to intimate the remote server about any data changes in the grid. This event has the same ui parameters as [[beforeValidate]] event but with a difference being that ui parameters are considered read only for this event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- addList
Type:
Array
Array of added rows { rowIndx: rowIndx, newRow: newRow, rowData: rowData }; newRow and rowData are same.
- updateList
Type:
Array
Array of updated rows { rowIndx: rowIndx, rowData: rowData, newRow: newRow, oldRow: oldRow }
- deleteList
Type:
Array
Array of deleted rows { rowIndx: rowIndx, rowData: rowData }
- source
Type:
String
origin of the change e.g., 'edit', 'update', 'add' , 'delete', 'paste', 'undo', 'redo' or a custom source passed to addRow, updateRow, deleteRow methods.
- allowInvalid
Type:
Boolean
Allows invalid value and adds an invalid class to the cell/cells.
- history
Type:
Boolean
Whether add this operation in history.
- checkEditable
Type:
Boolean
Checks whether the row/cell is editable before making any change.
Code examples:
Initialize the pqGrid with the change callback specified:
pq.grid( selector,{
change: function( event, ui ) {}
});
Bind an event listener to the pqGrid:change event:
grid.on( "change", function( event, ui ) {} );
check( event, ui )Type: pqGrid:check
Triggered after beforeCheck event is fired and checkbox state is changed in checkbox column, treegrid or row grouping with checkboxes.
In case of treegrid and row grouping with cascade checkboxes, only the directly affected nodes are present in rows.
Indirectly affected nodes can be found by [[ui.getCascadeList]] method.
When header checkbox is (un)checked, all the affected rows are present in [[ui.rows]] and [[ui.getCascadeList]] is undefined.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- check
Type:
Boolean
state of the checkbox.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- getCascadeList
Type:
function
function to retrieve complete collection of affected rows.
- rows
Type:
Array
Collection of row objects having rowIndx, rowData.
Code examples:
Initialize the pqGrid with the check callback specified:
pq.grid( selector,{
check: function( event, ui ) {}
});
Bind an event listener to the pqGrid:check event:
grid.on( "check", function( event, ui ) {} );
colAdd( event, ui )Type: pqGrid:colAdd
(v7.0.0) Triggered after new columns are added in the grid.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
arguemnts passed to Columns().add method.
Code examples:
Initialize the pqGrid with the colAdd callback specified:
pq.grid( selector,{
colAdd: function( event, ui ) {}
});
Bind an event listener to the pqGrid:colAdd event:
grid.on( "colAdd", function( event, ui ) {} );
colMove( event, ui )Type: pqGrid:colMove
(v7.1.0) Triggered when columns are moved within the grid through
[[Columns().move]] method.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
Arguments to Columns().move method.
Code examples:
Initialize the pqGrid with the colMove callback specified:
pq.grid( selector,{
colMove: function( event, ui ) {}
});
Bind an event listener to the pqGrid:colMove event:
grid.on( "colMove", function( event, ui ) {} );
colRemove( event, ui )Type: pqGrid:colRemove
(v7.0.0) Triggered after columns are removed from the grid.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
arguemnts passed to Columns().remove method.
Code examples:
Initialize the pqGrid with the colRemove callback specified:
pq.grid( selector,{
colRemove: function( event, ui ) {}
});
Bind an event listener to the pqGrid:colRemove event:
grid.on( "colRemove", function( event, ui ) {} );
columnCollapse( event, ui )Type: pqGrid:columnCollapse
Triggered when a grouped column is collapsed or expanded.
Current collapsed state of affected column can be obtained from
[[ui.column.collapsible.on]].
Refresh of colModel and view after this event can be prevented by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- column
Type:
Object
Object containing properties of this column.
Code examples:
Initialize the pqGrid with the columnCollapse callback specified:
pq.grid( selector,{
columnCollapse: function( event, ui ) {}
});
Bind an event listener to the pqGrid:columnCollapse event:
grid.on( "columnCollapse", function( event, ui ) {} );
columnDrag( event, ui )Type: pqGrid:columnDrag
Triggered just before any column is about to be dragged.
It can be used to limit the droppable columns by adding or removing nodrop property to them.
This event can also be canceled by returning false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- column
Type:
Object
Object containing properties of this column.
Code examples:
Initialize the pqGrid with the columnDrag callback specified:
pq.grid( selector,{
columnDrag: function( event, ui ) {}
});
Bind an event listener to the pqGrid:columnDrag event:
grid.on( "columnDrag", function( event, ui ) {} );
columnOrder( event, ui )Type: pqGrid:columnOrder
Triggered when any column is reordered by drag and drop.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- oldcolIndx
Type:
Integer
Old zero based index of the column.
- colIndx
Type:
Integer
New zero based index of the column.
Code examples:
Initialize the pqGrid with the columnOrder callback specified:
pq.grid( selector,{
columnOrder: function( event, ui ) {}
});
Bind an event listener to the pqGrid:columnOrder event:
grid.on( "columnOrder", function( event, ui ) {} );
columnResize( event, ui )Type: pqGrid:columnResize
Triggered when a column is resized.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- colIndx
Type:
Integer
Zero based index of the column.
- oldWidth
Type:
Integer
Previous width of the column.
- newWidth
Type:
Integer
New width of the column.
Code examples:
Initialize the pqGrid with the columnResize callback specified:
pq.grid( selector,{
columnResize: function( event, ui ) {}
});
Bind an event listener to the pqGrid:columnResize event:
grid.on( "columnResize", function( event, ui ) {} );
complete( event, ui )Type: pqGrid:complete
Triggered when grid has completed data binding and view rendering.
This event is generated once for each call to refreshDataAndView method.
Callback arguemnts
Code examples:
Initialize the pqGrid with the complete callback specified:
pq.grid( selector,{
complete: function( event, ui ) {}
});
context( event, ui )Type: pqGrid:context
(v7.2.0)Triggered when context menu is activated on any element of grid by right click with mouse, two finger tap on touchpad or long single finger tap in touch devices.
Inbuilt context menu of browser is not opened if the event handler returns false.
colIndx = -1 when event is fired on number cell.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data
- rowIndx
Type:
Integer
Zero based index of the row corresponding to cell
- colIndx
Type:
Integer
Zero based index of the column in colModel, is -1 in case of number cell
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON
- ele
Type:
Element
body cell, head cell, image or number cell DOM node
- filterRow
Type:
Boolean
true when contextmenu is on filter row cell
- type
Type:
String
'cell' for body cell, 'head' for header cell, 'img' for image or 'num' for number cell
Code examples:
Initialize the pqGrid with the context callback specified:
pq.grid( selector,{
context: function( event, ui ) {}
});
Bind an event listener to the pqGrid:context event:
grid.on( "context", function( event, ui ) {} );
copy( event, ui )Type: pqGrid:copy
(v8.4.0) Triggered after a range of cells are copied from grid.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- areas
Type:
array
Array of address objects having r1, r2, c1, c2 properties.
Code examples:
Initialize the pqGrid with the copy callback specified:
pq.grid( selector,{
copy: function( event, ui ) {}
});
Bind an event listener to the pqGrid:copy event:
grid.on( "copy", function( event, ui ) {} );
create( event, ui )Type: pqGrid:create
Triggered when the grid is created.
In case of local request, the data binding and view rendering is complete when this event occurs.
Use load event in case of remote request for availability of data.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataModel
Type:
Object
grid's dataModel.
- colModel
Type:
Array
grid's colModel.
Code examples:
Initialize the pqGrid with the create callback specified:
pq.grid( selector,{
create: function( event, ui ) {}
});
Bind an event listener to the pqGrid:create event:
grid.on( "create", function( event, ui ) {} );
dataReady( event, ui )Type: pqGrid:dataReady
Triggered when data is ready for rendering in the grid.
It happens after data is changed by addition, deletion,
filtering, sorting of records or call to refreshDataAndView(), refreshView() methods.
No changes in the data should be made in this event, it can be used to generate manual summary data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the dataReady callback specified:
pq.grid( selector,{
dataReady: function( event, ui ) {}
});
editorBegin( event, ui )Type: pqGrid:editorBegin
Triggered when editor is created.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorBegin callback specified:
pq.grid( selector,{
editorBegin: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorBegin event:
grid.on( "editorBegin", function( event, ui ) {} );
editorBlur( event, ui )Type: pqGrid:editorBlur
Triggered when editor is blurred.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorBlur callback specified:
pq.grid( selector,{
editorBlur: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorBlur event:
grid.on( "editorBlur", function( event, ui ) {} );
editorEnd( event, ui )Type: pqGrid:editorEnd
Triggered when editor is about to be destroyed.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorEnd callback specified:
pq.grid( selector,{
editorEnd: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorEnd event:
grid.on( "editorEnd", function( event, ui ) {} );
editorFocus( event, ui )Type: pqGrid:editorFocus
Triggered when editor is focused.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorFocus callback specified:
pq.grid( selector,{
editorFocus: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorFocus event:
grid.on( "editorFocus", function( event, ui ) {} );
editorKeyDown( event, ui )Type: pqGrid:editorKeyDown
Triggered when a key is input in an editor. Default behaviour of the keys in editor can be prevented by returning false in this event.
editorKeyPress and editorKeyUp are fired after this event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorKeyDown callback specified:
pq.grid( selector,{
editorKeyDown: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorKeyDown event:
grid.on( "editorKeyDown", function( event, ui ) {} );
editorKeyPress( event, ui )Type: pqGrid:editorKeyPress
Triggered when a key is pressed in an editor.
This event is fired after editorKeyDown event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorKeyPress callback specified:
pq.grid( selector,{
editorKeyPress: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorKeyPress event:
grid.on( "editorKeyPress", function( event, ui ) {} );
editorKeyUp( event, ui )Type: pqGrid:editorKeyUp
Triggered when a key is released after input in an editor.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
- $editor
Type:
jQuery
Editor.
Code examples:
Initialize the pqGrid with the editorKeyUp callback specified:
pq.grid( selector,{
editorKeyUp: function( event, ui ) {}
});
Bind an event listener to the pqGrid:editorKeyUp event:
grid.on( "editorKeyUp", function( event, ui ) {} );
exportData( event, ui )Type: pqGrid:exportData
Triggered after data is exported by the grid but before file is ready to download.
Callback arguemnts
Code examples:
Initialize the pqGrid with the exportData callback specified:
pq.grid( selector,{
exportData: function( event, ui ) {}
});
filter( event, ui )Type: pqGrid:filter
Triggered after data is filtered.
The structure of [[ui]] object is same as parameters passed to the filter method.
Please refer to filter method for details.
Callback arguemnts
Code examples:
Initialize the pqGrid with the filter callback specified:
pq.grid( selector,{
filter: function( event, ui ) {}
});
focus( event, ui )Type: pqGrid:focus
(v8.7.0) Triggered when any cell or empty region in grid body is focused
Callback arguemnts
Code examples:
Initialize the pqGrid with the focus callback specified:
pq.grid( selector,{
focus: function( event, ui ) {}
});
focusHead( event, ui )Type: pqGrid:focusHead
(v8.7.0) Triggered when any grid head cell is focused
Callback arguemnts
Code examples:
Initialize the pqGrid with the focusHead callback specified:
pq.grid( selector,{
focusHead: function( event, ui ) {}
});
group( event, ui )Type: pqGrid:group
Triggered when a grouped cell, whole level or all levels are expanded/collapsed.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- close
Type:
Boolean
collapsed state.
- all
Type:
Boolean
true when all group levels are affected, undefined otherwise.
- level
Type:
Integer
grouping level.
- group
Type:
String
grouping title when a single cell is affected, undefined otherwise.
Code examples:
Initialize the pqGrid with the group callback specified:
pq.grid( selector,{
group: function( event, ui ) {}
});
groupChange( event, ui )Type: pqGrid:groupChange
(v3.3.5) This event is triggered when
- new grouping level is added
- an existing level is removed.
- re-order of existing levels takes place.
Callback arguemnts
Code examples:
Initialize the pqGrid with the groupChange callback specified:
pq.grid( selector,{
groupChange: function( event, ui ) {}
});
groupData( event, ui )Type: pqGrid:groupData
This event is triggered when data is grouped for row grouping or pivot view.
Callback arguemnts
Code examples:
Initialize the pqGrid with the groupData callback specified:
pq.grid( selector,{
groupData: function( event, ui ) {}
});
groupHideRows( event, ui )Type: pqGrid:groupHideRows
(v7.2.0) This event is triggered just after children nodes are hidden or make visible depending upon
open / close state of their parent nodes.
Callback arguemnts
Code examples:
Initialize the pqGrid with the groupHideRows callback specified:
pq.grid( selector,{
groupHideRows: function( event, ui ) {}
});
groupOption( event, ui )Type: pqGrid:groupOption
(v5.1.0) This is triggered when group options are changed via Group().option() method.
Since toolPanel calls Group().option() to group / pivot data, this event can be used
to listen to changes made by user in toolPanel.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- oldGM
Type:
Object
shallow copy of previous groupModel before current change in group options.
Code examples:
Initialize the pqGrid with the groupOption callback specified:
pq.grid( selector,{
groupOption: function( event, ui ) {}
});
headerCellClick( event, ui )Type: pqGrid:headerCellClick
Triggered when a header cell is clicked.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- column
Type:
Object
Object containing properties of this column.
Code examples:
Initialize the pqGrid with the headerCellClick callback specified:
pq.grid( selector,{
headerCellClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:headerCellClick event:
grid.on( "headerCellClick", function( event, ui ) {} );
headRightClick( event, ui )Type: pqGrid:headRightClick
(v7.2.0) This event is deprecated and replaced by context event
(v6.0.0) Triggered when context menu is activated for a header cell including grouped header cells. Inbuilt context menu of browser is not opened if the event handler returns false.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- colIndx
Type:
Integer
Zero based index of the column.
- column
Type:
Object
Object containing properties of this column.
- filterRow
Type:
Boolean
true when contextmenu is on filter row cell
- $th
Type:
jQuery
jQuery wrapper on header cell.
Code examples:
Initialize the pqGrid with the headRightClick callback specified:
pq.grid( selector,{
headRightClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:headRightClick event:
grid.on( "headRightClick", function( event, ui ) {} );
hideCols( event, ui )Type: pqGrid:hideCols
Triggered after columns are hidden or displayed via header menu or API (new in v5.2.0).
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- diHide
Type:
Array
Array of dataIndx of columns being hidden.
- diShow
Type:
Array
Array of dataIndx of columns being displayed.
Code examples:
Initialize the pqGrid with the hideCols callback specified:
pq.grid( selector,{
hideCols: function( event, ui ) {}
});
history( event, ui )Type: pqGrid:history
Triggered whenever the grid's history is modified.
The ui object includes the following properties:
type (String)
Indicates the history-related action. Possible values:
- add — A new history entry was created due to a grid operation such as adding, updating, deleting rows, modifying columns, or reordering columns.
- undo — An undo action was performed (Ctrl+Z or
History.undo API).
- redo — A redo action was performed (Ctrl+Y or
History.redo API).
- reset — The grid's history was cleared via
History.reset API.
- rollback — The grid's history was cleared via
rollback method. (v11.1.0)
canUndo (Boolean)
Indicates whether an undo action can currently be performed.
canRedo (Boolean)
Indicates whether a redo action can currently be performed.
num_undo (Integer)
Number of undo actions currently available.
num_redo (Integer)
Number of redo actions currently available.
Callback arguemnts
Code examples:
Initialize the pqGrid with the history callback specified:
pq.grid( selector,{
history: function( event, ui ) {}
});
Bind an event listener to the pqGrid:history event:
grid.on( "history", function( event, ui ) {} );
lazyInit( event, ui )Type: pqGrid:lazyInit
(v8.5.0) Applicable to lazy loading, it's triggered before grid begins loading first batch of remote data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the lazyInit callback specified:
pq.grid( selector,{
lazyInit: function( event, ui ) {}
});
Bind an event listener to the pqGrid:lazyInit event:
grid.on( "lazyInit", function( event, ui ) {} );
lazyProgress( event, ui )Type: pqGrid:lazyProgress
(v8.5.0) Applicable to lazy loading, it's triggered while grid is loading batches of remote data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the lazyProgress callback specified:
pq.grid( selector,{
lazyProgress: function( event, ui ) {}
});
Bind an event listener to the pqGrid:lazyProgress event:
grid.on( "lazyProgress", function( event, ui ) {} );
lazyComplete( event, ui )Type: pqGrid:lazyComplete
(v8.5.0) Applicable to lazy loading, it's triggered when grid is finished loading all remote data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the lazyComplete callback specified:
pq.grid( selector,{
lazyComplete: function( event, ui ) {}
});
Bind an event listener to the pqGrid:lazyComplete event:
grid.on( "lazyComplete", function( event, ui ) {} );
load( event, ui )Type: pqGrid:load
Triggered after the grid has loaded the remote data.
Callback arguemnts
Code examples:
Initialize the pqGrid with the load callback specified:
pq.grid( selector,{
load: function( event, ui ) {}
});
Bind an event listener to the pqGrid:load event:
grid.on( "load", function( event, ui ) {} );
moveNode( event, ui )Type: pqGrid:moveNode
Triggered when nodes or rows are moved via [[moveNodes]] method in grid, row groupings or treegrid.
This event is also triggered after drag & drop of rows because [[moveNodes]] method is called internally by grid in default [[dropModel.drop]] callback implementation.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- args
Type:
Array
(v6.1.0) arguments passed to moveNodes method.
Code examples:
Initialize the pqGrid with the moveNode callback specified:
pq.grid( selector,{
moveNode: function( event, ui ) {}
});
Bind an event listener to the pqGrid:moveNode event:
grid.on( "moveNode", function( event, ui ) {} );
paste( event, ui )Type: pqGrid:paste
Triggered after data is pasted in the grid
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- areas
Type:
Array
rectangular regions affected by paste.
- rows
Type:
Array
Array of pasted rows.
Code examples:
Initialize the pqGrid with the paste callback specified:
pq.grid( selector,{
paste: function( event, ui ) {}
});
pivotCM( event, ui )Type: pqGrid:pivotCM
Triggered when pivot colModel is generated before pivot grid is displayed.(v 5.3.0).
This event is very useful to customize pivot view by change, add, removal of columns in pivot view.
Callback arguemnts
Code examples:
Initialize the pqGrid with the pivotCM callback specified:
pq.grid( selector,{
pivotCM: function( event, ui ) {}
});
Bind an event listener to the pqGrid:pivotCM event:
grid.on( "pivotCM", function( event, ui ) {} );
refresh( event, ui )Type: pqGrid:refresh
Triggered whenever the view of grid is refreshed.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- pageData
Type:
Array
2-dimensional array or JSON data for current page.
- initV
Type:
Integer
Index of first row displayed in the unfrozen viewport.
- finalV
Type:
Integer
Index of last row displayed in the unfrozen viewport.
- initH
Type:
Integer
Index of first column displayed in the unfrozen viewport.
- finalH
Type:
Integer
Index of last column displayed in the unfrozen viewport.
- source
Type:
String
Custom string passed to refresh. Added in 3.0.0
Code examples:
Initialize the pqGrid with the refresh callback specified:
pq.grid( selector,{
refresh: function( event, ui ) {}
});
Bind an event listener to the pqGrid:refresh event:
grid.on( "refresh", function( event, ui ) {} );
refreshHeader( event, ui )Type: pqGrid:refreshHeader
Triggered whenever header is refreshed.
Callback arguemnts
Code examples:
Initialize the pqGrid with the refreshHeader callback specified:
pq.grid( selector,{
refreshHeader: function( event, ui ) {}
});
Bind an event listener to the pqGrid:refreshHeader event:
grid.on( "refreshHeader", function( event, ui ) {} );
refreshRow( event, ui )Type: pqGrid:refreshRow
Triggered whenever a row is refreshed via call to refreshRow method.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
- rowIndxPage
Type:
Integer
Zero based index of the row on current page.
Code examples:
Initialize the pqGrid with the refreshRow callback specified:
pq.grid( selector,{
refreshRow: function( event, ui ) {}
});
Bind an event listener to the pqGrid:refreshRow event:
grid.on( "refreshRow", function( event, ui ) {} );
render( event, ui )Type: pqGrid:render
Triggered just after grid's DOM structure is created but before grid is fully initialized. This event is suitable for adding toolbars, etc.
Any grid API can't be accessed in this event because the grid initialization is incomplete when this event is fired.
This event fires before create event.
Callback arguemnts
Code examples:
Initialize the pqGrid with the render callback specified:
pq.grid( selector,{
render: function( event, ui ) {}
});
Bind an event listener to the pqGrid:render event:
grid.on( "render", function( event, ui ) {} );
rowClick( event, ui )Type: pqGrid:rowClick
Triggered when a row is clicked in grid. It occurs after cellClick event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- $tr
Type:
jQuery
jQuery wrapper on the row.
- rowIndx
Type:
Integer
Zero based index of the row.
- rowIndxPage
Type:
Integer
Zero based index of the row on current page.
Code examples:
Initialize the pqGrid with the rowClick callback specified:
pq.grid( selector,{
rowClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:rowClick event:
grid.on( "rowClick", function( event, ui ) {} );
rowDblClick( event, ui )Type: pqGrid:rowDblClick
Triggered when a row is double clicked in grid. It occurs after cellDblClick event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- $tr
Type:
jQuery
jQuery wrapper on the row.
- rowIndx
Type:
Integer
Zero based index of the row.
- rowIndxPage
Type:
Integer
Zero based index of the row on current page.
Code examples:
Initialize the pqGrid with the rowDblClick callback specified:
pq.grid( selector,{
rowDblClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:rowDblClick event:
grid.on( "rowDblClick", function( event, ui ) {} );
rowRightClick( event, ui )Type: pqGrid:rowRightClick
(v7.2.0) Removed. Please use context event instead of this.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- rowData
Type:
Object
Reference to 1-dimensional array or object representing row data.
- rowIndx
Type:
Integer
Zero based index of the row.
Code examples:
Initialize the pqGrid with the rowRightClick callback specified:
pq.grid( selector,{
rowRightClick: function( event, ui ) {}
});
Bind an event listener to the pqGrid:rowRightClick event:
grid.on( "rowRightClick", function( event, ui ) {} );
rowSelect( event, ui )Type: pqGrid:rowSelect
Triggered when rows have been selected or unselected in grid.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- addList
Type:
Array
Array of selected rows { rowIndx: rowIndx, rowData: rowData }
- deleteList
Type:
Array
Array of unselected rows { rowIndx: rowIndx, rowData: rowData }
Code examples:
Initialize the pqGrid with the rowSelect callback specified:
pq.grid( selector,{
rowSelect: function( event, ui ) {}
});
Bind an event listener to the pqGrid:rowSelect event:
grid.on( "rowSelect", function( event, ui ) {} );
scroll( event, ui )Type: pqGrid:scroll
Triggered when grid is scrolled.
Use this event wisely or use scrollStop event otherwise it may slow down the scrolling.
Callback arguemnts
Code examples:
Initialize the pqGrid with the scroll callback specified:
pq.grid( selector,{
scroll: function( event, ui ) {}
});
Bind an event listener to the pqGrid:scroll event:
grid.on( "scroll", function( event, ui ) {} );
scrollStop( event, ui )Type: pqGrid:scrollStop
Triggered when grid scrolling is stopped or paused after scrollModel.timeout milliseconds.
Callback arguemnts
Code examples:
Initialize the pqGrid with the scrollStop callback specified:
pq.grid( selector,{
scrollStop: function( event, ui ) {}
});
Bind an event listener to the pqGrid:scrollStop event:
grid.on( "scrollStop", function( event, ui ) {} );
selectChange( event, ui )Type: pqGrid:selectChange
Triggered whenever selection is changed by user action or by invoking the selection API.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- selection
Type:
Object
an instance of selection object.
Code examples:
Initialize the pqGrid with the selectChange callback specified:
pq.grid( selector,{
selectChange: function( event, ui ) {}
});
Bind an event listener to the pqGrid:selectChange event:
grid.on( "selectChange", function( event, ui ) {} );
selectEnd( event, ui )Type: pqGrid:selectEnd
Similar to selectChange except
that it's fired when user is done making the selection with keyboard or mouse.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- selection
Type:
Object
An instance of selection object.
Code examples:
Initialize the pqGrid with the selectEnd callback specified:
pq.grid( selector,{
selectChange: function( event, ui ) {}
});
Bind an event listener to the pqGrid:selectEnd event:
grid.on( "selectEnd", function( event, ui ) {} );
skipExport( event, ui )Type: pqGrid:skipExport
(v9.0.0) It's fired when user selects the exported columns from header popup menu.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- di
Type:
Array
Array of dataIndx of affected columns.
Code examples:
Initialize the pqGrid with the skipExport callback specified:
pq.grid( selector,{
skipExport: function( event, ui ) {}
});
Bind an event listener to the pqGrid:skipExport event:
grid.on( "skipExport", function( event, ui ) {} );
sort( event, ui )Type: pqGrid:sort
Triggered after data is sorted in the grid. It fires only when sorting takes place by click on the header cell in versions < v3.0.0, but since v3.0.0 it fires whenever the data is sorted irrespective of the origin, it may be initiated by click on header cell or by invoking sort method. See sortModel option for description of various ui properties.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- dataIndx
Type:
Integer or String
Zero based index in array or key name in JSON.
- single
Type:
Boolean
multiple column sorting when false. Available since v3.0.0
- oldSorter
Type:
Array
An array of objects having dataIndx and dir providing previous sorting information. Available since v3.0.0
- sorter
Type:
Array
An array of objects having dataIndx and dir. Available since v3.0.0
Code examples:
Initialize the pqGrid with the sort callback specified:
pq.grid( selector,{
sort: function( event, ui ) {}
});
Bind an event listener to the pqGrid:sort event:
grid.on( "sort", function( event, ui ) {} );
tabActivate( event, ui )Type: pqGrid:tabActivate
(v8.6.0) Triggered when tab is acivated.
Callback arguemnts
Code examples:
Initialize the pqGrid with the tabActivate callback specified:
pq.grid( selector,{
tabActivate: function( event, ui ) {}
});
Bind an event listener to the pqGrid:tabActivate event:
grid.on( "tabActivate", function( event, ui ) {} );
tabsReady( event, ui )Type: pqGrid:tabsReady
(v8.6.0) Triggered when tabs are ready to be rendered after import from Excel.
Any last moment changes in the tabs can be done in this event.
Callback arguemnts
Code examples:
Initialize the pqGrid with the tabsReady callback specified:
pq.grid( selector,{
tabsReady: function( event, ui ) {
this.Tab().tabs().forEach(function(tab){
tab.noClose = true; //disable the close button of all tabs.
})
}
});
Bind an event listener to the pqGrid:tabsReady event:
grid.on( "tabsReady", function( event, ui ) {} );
tabRename( event, ui )Type: pqGrid:tabRename
(v8.6.0) Triggered after tab is renamed
Callback arguemnts
Code examples:
Initialize the pqGrid with the tabRename callback specified:
pq.grid( selector,{
tabRename: function( event, ui ) {}
});
Bind an event listener to the pqGrid:tabRename event:
grid.on( "tabRename", function( event, ui ) {} );
toggle( event, ui )Type: pqGrid:toggle
Triggered when toggle button is clicked and grid alternates between maximized and normal state.
By default, grid occupies whole document height (height: '100%')
and width (width:'100%') in maximized state, which can be customized in this event.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- state
Type:
String
'max' or 'min' where 'max' is maximized overlay state and 'min' is default state of grid.
Code examples:
Initialize the pqGrid with the toggle callback specified:
pq.grid( selector,{
toggle: function( event, ui ) {}
});
Bind an event listener to the pqGrid:toggle event:
grid.on( "toggle", function( event, ui ) {
if(ui.state == 'max' ){
//customize height of grid in maximize state.
this.option("height", "100%-50");
}
});
treeExpand( event, ui )Type: pqGrid:treeExpand
Triggered when tree nodes are either collapsed or expanded.
Callback arguemnts
- event
Type:
Event
- ui
Type:
Object
- nodes
Type:
Array
Array of rows (rowData) being affected.
- close
Type:
Boolean
true when collapse and false when expand.
Code examples:
Initialize the pqGrid with the treeExpand callback specified:
pq.grid( selector,{
treeExpand: function( event, ui ) {}
});
Bind an event listener to the pqGrid:treeExpand event:
grid.on( "treeExpand", function( event, ui ) {} );