|
|
|
|
|
|
|
|
|
Appearance
|
|
|
|
|
|
|
|
|
|
|
|
Name
|
Type
|
Default
|
altrows
|
Boolean
|
false
|
Enables or disables the alternating rows.
Code example
Set the altrows property.
$('#jqxGrid').jqxGrid({ altrows: false});
Get the altrows property.
var altrows = $('#jqxGrid').jqxGrid('altrows');
|
altstart
|
Number
|
1
|
This property specifies the first alternating row.
Code example
Set the altstart property.
$('#jqxGrid').jqxGrid({ altstart: 2});
Get the altstart property.
var altstart = $('#jqxGrid').jqxGrid('altstart');
|
altstep
|
Number
|
1
|
Sets or gets the alternating step
Code example
Set the altstep property.
$('#jqxGrid').jqxGrid({ altstep: 2});
Get the altstep property.
var altstep = $('#jqxGrid').jqxGrid('altstep');
|
autoshowloadelement
|
Boolean
|
true
|
Determines whether the loading image should be displayed until the Grid's data is loaded.
Code example
Set the autoshowloadelement property.
$('#jqxGrid').jqxGrid({ autoshowloadelement: false});
Get the autoshowloadelement property.
var autoshowloadelement = $('#jqxGrid').jqxGrid('autoshowloadelement');
|
autoshowfiltericon
|
Boolean
|
true
|
(requires jqxgrid.filter.js)
Displays the filter icon only when the column is filtered. When the value of this property is set to false, all grid columns will display a filter icon when the filtering is enabled.
Code example
Set the autoshowfiltericon property.
$('#jqxGrid').jqxGrid({ autoshowfiltericon: false});
Get the autoshowfiltericon property.
var autoshowfiltericon = $('#jqxGrid').jqxGrid('autoshowfiltericon');
|
autoshowcolumnsmenubutton
|
Boolean
|
true
|
(requires jqxmenu.js)
Sets or gets whether the columns menu button will be displayed only when the mouse cursor is over a columns header or will be always displayed.
Code example
Set the autoshowcolumnsmenubutton property.
$('#jqxGrid').jqxGrid({ autoshowcolumnsmenubutton: false});
Get the autoshowcolumnsmenubutton property.
var autoshowcolumnsmenubutton = $('#jqxGrid').jqxGrid('autoshowcolumnsmenubutton');
|
clipboard
|
Boolean
|
true
|
Enables or disables the clipboard operations
Code example
Set the clipboard property.
$('#jqxGrid').jqxGrid({ clipboard: false});
Get the clipboard property.
var clipboard = $('#jqxGrid').jqxGrid('clipboard');
|
closeablegroups
|
Boolean
|
true
|
(requires jqxgrid.grouping.js)
When the value of this property is true, a close button is displayed in each grouping column.
Code example
Set the closeablegroups property specified.
$('#jqxGrid').jqxGrid({ closeablegroups: false});
Get the closeablegroups property.
var closeablegroups = $('#jqxGrid').jqxGrid('closeablegroups');
|
columnsmenuwidth
|
Number
|
15
|
(requires jqxmenu.js)
Sets or gets the columns menu width.
Code example
Set the columnsmenuwidth property.
$('#jqxGrid').jqxGrid({ columnsmenuwidth: 20});
Get the columnsmenuwidth property.
var columnsmenuwidth = $('#jqxGrid').jqxGrid('columnsmenuwidth');
|
columnmenuopening
|
Function
|
null
|
Callback called when a column menu is opening. You can use it for changing the size of the menu or cancelling the opening. Three params are passed - menu, datafield and menu's height. If you return false, the opening will be cancelled.
Code example
Set the columnmenuopening property.
$('#jqxGrid').jqxGrid({ columnmenuopening: function (menu, datafield, height) {
var column = $("#jqxgrid").jqxGrid('getcolumn', datafield);
if (column.filtertype === "custom") {
menu.height(155);
}
else menu.height(height);
}});
Get the columnmenuopening property.
var columnmenuopening = $('#jqxGrid').jqxGrid('columnmenuopening');
|
columnmenuclosing
|
Function
|
null
|
Callback called when a column menu is closing. Three params are passed - menu, datafield and menu's height. If you return false, the closing will be cancelled.
Code example
Set the columnmenuclosing property.
$('#jqxGrid').jqxGrid({ columnmenuclosing: function (menu, datafield, height) {
}});
Get the columnmenuclosing property.
var columnmenuclosing = $('#jqxGrid').jqxGrid('columnmenuclosing');
|
cellhover
|
Function
|
null
|
Callback called when a cell is hovered.
Code example
Set the cellhover property.
$('#jqxGrid').jqxGrid({ cellhover: function (cellhtmlElement, x, y) {
}});
Get the cellhover property.
var cellhover = $('#jqxGrid').jqxGrid('cellhover');
|
enablekeyboarddelete
|
Boolean
|
true
|
Enables or disables the delete of a cell/row values by using the "delete" key. The property has effect when editable property is set to true, a row or cell is selected and the user presses the Del key.
Code example
Set the enablekeyboarddelete property.
$('#jqxGrid').jqxGrid({ enablekeyboarddelete: false});
Get the enablekeyboarddelete property.
var enablekeyboarddelete = $('#jqxGrid').jqxGrid('enablekeyboarddelete');
|
enableellipsis
|
Boolean
|
true
|
Determines whether ellipsis will be displayed, if the cells or columns content overflows.
Code example
Set the enableellipsis property.
$('#jqxGrid').jqxGrid({ enableellipsis: false});
Get the enableellipsis property.
var enableellipsis = $('#jqxGrid').jqxGrid('enableellipsis');
|
enablemousewheel
|
Boolean
|
true
|
Determines whether mousewheel scrolling is enabled.
Code example
Set the enablemousewheel property.
$('#jqxGrid').jqxGrid({ enablemousewheel: false});
Get the enablemousewheel property.
var enablemousewheel = $('#jqxGrid').jqxGrid('enablemousewheel');
|
enableanimations
|
Boolean
|
true
|
Enables or disables the grid animations.
Code example
Set the enableanimations property.
$('#jqxGrid').jqxGrid({ enableanimations: false});
Get the enableanimations property.
var enableanimations = $('#jqxGrid').jqxGrid('enableanimations');
|
enabletooltips
|
Boolean
|
false
|
Enables or disables the grid tooltips.
Code example
Set the enabletooltips property.
$('#jqxGrid').jqxGrid({ enabletooltips: false});
Get the enabletooltips property.
var enabletooltips = $('#jqxGrid').jqxGrid('enabletooltips');
|
enablehover
|
Boolean
|
true
|
Enables or disables the grid rows hover state.
Code example
Set the enablehover property.
$('#jqxGrid').jqxGrid({ enablehover: false});
Get the enablehover property.
var enablehover = $('#jqxGrid').jqxGrid('enablehover');
|
enablebrowserselection
|
Boolean
|
false
|
Enables the text selection of the browser.
Code example
Set the enablebrowserselection property.
$('#jqxGrid').jqxGrid({ enablebrowserselection: true});
Get the enablehover property.
var enablebrowserselection = $('#jqxGrid').jqxGrid('enablebrowserselection');
|
everpresentrowposition
|
String
|
'top'
|
Sets the position of the ever present row. Possible values: "top", "bottom", "topAboveFilterRow".
Code example
Set the everpresentrowposition property.
$('#jqxGrid').jqxGrid({ everpresentrowposition: 'bottom'});
Get the everpresentrowposition property.
var everpresentrowposition = $('#jqxGrid').jqxGrid('everpresentrowposition');
|
everpresentrowheight
|
Number
|
30
|
Sets the height of the ever present row.
Code example
Set the everpresentrowheight property.
$('#jqxGrid').jqxGrid({ everpresentrowheight: 35});
Get the everpresentrowheight property.
var everpresentrowheight = $('#jqxGrid').jqxGrid('everpresentrowheight');
|
everpresentrowactions
|
String
|
"add reset"
|
Sets the actions of the ever present row. Possible values: "add", "reset", "update", "delete".
Instead of "add", you can also use "addBottom" which is the same as "add", but adds the new row to the bottom of the Grid.
Code example
Set the everpresentrowactions property.
$('#jqxGrid').jqxGrid({ everpresentrowactions: "add update delete reset"});
Get the everpresentrowactions property.
var everpresentrowactions = $('#jqxGrid').jqxGrid('everpresentrowactions');
|
everpresentrowactionsmode
|
String
|
"popup"
|
Sets the actions display mode. By default they are displayed in a popup. You can set the property to "columns" and define columns with datafields - addButtonColumn, resetButtonColumn, updateButtonColumn and deleteButtonColumn to display the actions in columns.
Code example
Set the everpresentrowactionsmode property.
$('#jqxGrid').jqxGrid({ everpresentrowactionsmode: "add update delete reset"});
Get the everpresentrowactionsmode property.
var everpresentrowactionsmode = $('#jqxGrid').jqxGrid('everpresentrowactionsmode');
|
filterrowheight
|
Number
|
31
|
Sets or gets the filter row's height.
Code example
Initialize a Grid with the filterrowheight property specified.
$('#jqxGrid').jqxGrid({ filterrowheight: 30});
Get the filterrowheight property.
var filterrowheight = $('#jqxGrid').jqxGrid('filterrowheight');
|
filtermode
|
String
|
"default"
|
(requires jqxgrid.filter.js)
The property specifies the type of rendering of the Filter Menu. Possible values: "default" and "excel". In "excel" mode, the Filter Menu displays a ListBox with Checkboxes with all unique cell values.
Code example
Set the filtermode property.
$('#jqxGrid').jqxGrid({ filtermode: 'excel'});
Get the filtermode property.
var filtermode = $('#jqxGrid').jqxGrid('filtermode');
|
groupsrenderer
|
function
|
null
|
(requires jqxgrid.grouping.js)
This function is called when a group is rendered. You can use it to customize the default group rendering.
Code example
Set the groupsrenderer function.
var groupsrenderer = function (text, group, expanded) {
return "" + group + "";
}
$("#jqxGrid").jqxGrid(
{
source: source,
groupsrenderer: groupsrenderer,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry' }
],
groupable: true,
groups: ['ShipCity']
});
Get the groupsrenderer function.
var groupsrenderer = $('#jqxGrid').jqxGrid('groupsrenderer');
|
groupcolumnrenderer
|
function
|
null
|
(requires jqxgrid.grouping.js)
Sets or gets a custom renderer for the grouping columns displayed in the grouping header when the grouping feature is enabled.
Code example
Set the groupcolumnrenderer function.
var groupcolumnrenderer = function (text) {
return '<div style="padding: 5px; float: left; color: Blue;">' + text + '</div>';
}
$("#jqxgrid").jqxGrid(
{
source: source,
groupcolumnrenderer: groupcolumnrenderer,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry' }
],
groupable: true,
groups: ['ShipCity']
});
Get the groupcolumnrenderer function.
var groupcolumnrenderer = $('#jqxGrid').jqxGrid('groupcolumnrenderer');
|
groupsexpandedbydefault
|
Boolean
|
false
|
(requires jqxgrid.grouping.js)
Sets or gets the default state of the grouped rows.
Code example
Set the groupsexpandedbydefault property.
$('#jqxGrid').jqxGrid({ groupsexpandedbydefault: true});
Get the groupsexpandedbydefault property.
var groupsexpandedbydefault = $('#jqxGrid').jqxGrid('groupsexpandedbydefault');
|
handlekeyboardnavigation
|
function
|
null
|
The function is called when a key is pressed. If the result of the function is true, the default keyboard navigation will be overriden for the pressed key.
Code example
Set the handlekeyboardnavigation function.
var handleKeys = function(event)
{
var key = event.charCode ? event.charCode : event.keyCode ? event.keyCode : 0;
}
$('#jqxGrid').jqxGrid({ handlekeyboardnavigation: handleKeys});
Get the handlekeyboardnavigation function.
var handlekeyboardnavigation = $('#jqxGrid').jqxGrid('handlekeyboardnavigation');
|
pagerrenderer
|
function
|
null
|
(requires jqxgrid.pager.js)
The function is called when the Grid Pager is rendered. This allows you to customize the
default rendering of the pager.
Code example
Set the pagerrenderer property.
var pagerrenderer = function () {
var element = $("<div style='margin-top: 5px; width: 100%; height: 100%;'></div>");
var paginginfo = $("#jqxgrid").jqxGrid('getpaginginformation');
for (i = 0; i < paginginfo.pagescount; i++) {
var anchor = $("<a style='padding: 5px;' href='#" + i + "'>" + i + "</a>");
anchor.appendTo(element);
anchor.click(function (event) {
var pagenum = parseInt($(event.target).text());
$("#jqxgrid").jqxGrid('gotopage', pagenum);
});
}
return element;
}
$("#jqxgrid").jqxGrid(
{
width: 670,
source: source,
pagerrenderer: pagerrenderer,
sortable: true,
pageable: true,
autoheight: true,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' },
{ text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' },
{ text: 'Ship Address', datafield: 'ShipAddress', width: 350 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry', width: 100 }
]
});
Get the pagerrenderer property.
var pagerrenderer = $('#jqxGrid').jqxGrid('pagerrenderer');
|
rtl
|
Boolean
|
false
|
Sets or gets a value indicating whether widget's elements are aligned to support locales using right-to-left fonts.
Code example
Set the rtl property.
$('#jqxGrid').jqxGrid({rtl : true});
Get the rtl property.
var rtl = $('#jqxGrid').jqxGrid('rtl');
|
showdefaultloadelement
|
Boolean
|
true
|
Determines whether the Grid should display the built-in loading element or should use a DIV tag with class 'jqx-grid-load'
Code example
Set the showdefaultloadelement property.
$('#jqxGrid').jqxGrid({ showdefaultloadelement: false});
Get the showdefaultloadelement property.
var showdefaultloadelement = $('#jqxGrid').jqxGrid('showdefaultloadelement');
|
showfiltercolumnbackground
|
Boolean
|
true
|
(requires jqxgrid.filter.js)
When this property is true, the Grid adds an additional visual style to the grid cells in the filter column(s).
Code example
Set the showfiltercolumnbackground property.
$('#jqxGrid').jqxGrid({ showfiltercolumnbackground: false});
Get the showfiltercolumnbackground property.
var showfiltercolumnbackground = $('#jqxGrid').jqxGrid('showfiltercolumnbackground');
|
showfiltermenuitems
|
Boolean
|
true
|
(requires jqxgrid.filter.js)
Determines whether to display the filtering items in the column's menu.
Code example
Set the showfiltermenuitems property.
$('#jqxGrid').jqxGrid({ showfiltermenuitems: false});
Get the showfiltermenuitems property.
var showfiltermenuitems = $('#jqxGrid').jqxGrid('showfiltermenuitems');
|
showpinnedcolumnbackground
|
Boolean
|
true
|
When this property is true, the Grid adds an additional visual style to the grid cells in the pinned column(s).
Code example
Set the showpinnedcolumnbackground property.
$('#jqxGrid').jqxGrid({ showpinnedcolumnbackground: false});
Get the showpinnedcolumnbackground property.
var showpinnedcolumnbackground = $('#jqxGrid').jqxGrid('showpinnedcolumnbackground');
|
showsortcolumnbackground
|
Boolean
|
true
|
(requires jqxgrid.sort.js)
When this property is true, the Grid adds an additional visual style to the grid cells in the sort column.
Code example
Set the showsortcolumnbackground property.
$('#jqxGrid').jqxGrid({ showsortcolumnbackground: false});
Get the showsortcolumnbackground property.
var showsortcolumnbackground = $('#jqxGrid').jqxGrid('showsortcolumnbackground');
|
showsortmenuitems
|
Boolean
|
true
|
(requires jqxgrid.sort.js)
Determines whether to display the sort menu items.
Code example
Set the showsortmenuitems property.
$('#jqxGrid').jqxGrid({ showsortmenuitems: false});
Get the showsortmenuitems property.
var showsortmenuitems = $('#jqxGrid').jqxGrid('showsortmenuitems');
|
showgroupmenuitems
|
Boolean
|
true
|
(requires jqxgrid.grouping.js)
Determines whether to display the group menu items.
Code example
Set the showgroupmenuitems property.
$('#jqxGrid').jqxGrid({ showgroupmenuitems: false});
Get the showgroupmenuitems property.
var showgroupmenuitems = $('#jqxGrid').jqxGrid('showgroupmenuitems');
|
showrowdetailscolumn
|
Boolean
|
true
|
Shows an additional column with expand/collapse toggle buttons when the Row details feature is enabled.
Code example
Set the showrowdetailscolumn property.
$('#jqxGrid').jqxGrid({ showrowdetailscolumn: false});
Get the showrowdetailscolumn property.
var showrowdetailscolumn = $('#jqxGrid').jqxGrid('showrowdetailscolumn');
|
showheader
|
Boolean
|
true
|
Shows or hides the columns header.
Code example
Set the showheader property.
$('#jqxGrid').jqxGrid({ showheader: false});
Get the showheader property.
var showheader = $('#jqxGrid').jqxGrid('showheader');
|
showgroupsheader
|
Boolean
|
true
|
(requires jqxgrid.grouping.js)
Shows or hides the groups header area.
Code example
Set the showgroupsheader property.
$('#jqxGrid').jqxGrid({ showgroupsheader: true});
Get the showgroupsheader property.
var showgroupsheader = $('#jqxGrid').jqxGrid('showgroupsheader');
|
showaggregates
|
Boolean
|
false
|
(requires jqxgrid.aggregates.js)
Shows or hides the aggregates in the grid's statusbar.
Code example
Set the showaggregates property.
$('#jqxGrid').jqxGrid({ showaggregates: true});
Get the showaggregates property.
var showaggregates = $('#jqxGrid').jqxGrid('showaggregates');
|
showgroupaggregates
|
Boolean
|
false
|
(requires jqxgrid.aggregates.js and jqxgrid.grouping.js)
Shows or hides the aggregates in Grid groups.
Code example
Set the showgroupaggregates property.
$('#jqxGrid').jqxGrid({ showgroupaggregates: true});
Get the showgroupaggregates property.
var showgroupaggregates = $('#jqxGrid').jqxGrid('showgroupaggregates');
|
showeverpresentrow
|
Boolean
|
false
|
Shows or hides an additional row in jqxGrid which allows you to easily add new rows.
Code example
Set the showeverpresentrow property.
$('#jqxGrid').jqxGrid({ showeverpresentrow: true});
Get the showeverpresentrow property.
var showeverpresentrow = $('#jqxGrid').jqxGrid('showeverpresentrow');
|
showfilterrow
|
Boolean
|
false
|
(requires jqxgrid.filter.js)
Shows or hides the filter row.
Code example
Set the showfilterrow property.
$('#jqxGrid').jqxGrid({ showfilterrow: true});
Get the showfilterrow property.
var showfilterrow = $('#jqxGrid').jqxGrid('showfilterrow');
|
showemptyrow
|
Boolean
|
true
|
Shows or hides the empty row label when the Grid has no records to display.
Code example
Set the showemptyrow property.
$('#jqxGrid').jqxGrid({ showemptyrow: false});
Get the showemptyrow property.
var showemptyrow = $('#jqxGrid').jqxGrid('showemptyrow');
|
showstatusbar
|
Boolean
|
false
|
Shows or hides the grid's statusbar.
Code example
Set the showstatusbar property.
$('#jqxGrid').jqxGrid({ showstatusbar: true});
Get the showstatusbar property.
var showstatusbar = $('#jqxGrid').jqxGrid('showstatusbar');
|
statusbarheight
|
Number
|
34
|
Sets the statusbar's height.
Code example
Set the statusbarheight property.
$('#jqxGrid').jqxGrid({ statusbarheight: 40});
Get the statusbarheight property.
var statusbarheight = $('#jqxGrid').jqxGrid('statusbarheight');
|
showtoolbar
|
Boolean
|
false
|
Shows or hides the grid's toolbar.
Code example
Set the showtoolbar property.
$('#jqxGrid').jqxGrid({ showtoolbar: true});
Get the showtoolbar property.
var showtoolbar = $('#jqxGrid').jqxGrid('showtoolbar');
|
selectionmode
|
String
|
'singlerow'
|
(requires jqxgrid.selection.js)
Sets or gets the selection mode.
Possible Values:
'none'-disables the selection
'singlerow'- full row selection
'multiplerows' - each click selects a new row. Click on a selected row unselects it
'multiplerowsextended' - multiple rows selection with drag and drop. The selection behavior resembles the selection of icons on your desktop
'singlecell' - single cell selection
'multiplecells' - each click selects a new cell. Click on a selected cell unselects it
'multiplecellsextended' - in this mode, users can select multiple cells with a drag and drop. The selection behavior resembles the selection of icons on your desktop
'multiplecellsadvanced' - this mode is the most advanced cells selection mode. In this mode, users can select multiple cells with a drag and drop. The selection behavior resembles the selection of cells in a spreadsheet
'checkbox' - multiple rows selection through a checkbox.
Code example
Set the selectionmode property.
$('#jqxGrid').jqxGrid({ selectionmode: 'none'});
Get the selectionmode property.
var selectionmode = $('#jqxGrid').jqxGrid('selectionmode');
|
theme
|
String
|
''
|
Sets the widget's theme.
jQWidgets uses a pair of css files - jqx.base.css and jqx.[theme name].css. The base stylesheet creates the styles related to the widget's layout like margin, padding, border-width, position. The second css file applies the widget's colors and backgrounds. The jqx.base.css should be included before the second CSS file.
In order to set a theme, you need to do the following:
|
toolbarheight
|
Number
|
34
|
Sets or gets the toolbar's height.
Code example
Set the toolbarheight property.
$('#jqxGrid').jqxGrid({ toolbarheight: 40});
Get the toolbarheight property.
var toolbarheight = $('#jqxGrid').jqxGrid('toolbarheight');
|
|
|
|
|
|
|
|
|
|
Layout
|
|
|
|
|
|
|
|
|
|
|
|
Name
|
Type
|
Default
|
autoheight
|
Boolean
|
false
|
Sets or gets the height of the grid to be equal to the summary height of the grid rows. This option should be set when the Grid is in paging mode.
Code example
Set the autoheight property.
$('#jqxGrid').jqxGrid({ autoheight: true});
Get the autoheight property.
var autoheight = $('#jqxGrid').jqxGrid('autoheight');
|
autorowheight
|
Boolean
|
false
|
This property works along with the "autoheight" property. When it is set to true, the height of the Grid rows is dynamically changed depending on the cell values.
Code example
Set the autorowheight property.
$('#jqxGrid').jqxGrid({ autorowheight: true});
Get the autorowheight property.
var autorowheight = $('#jqxGrid').jqxGrid('autorowheight');
|
columnsheight
|
Number
|
30
|
Sets or gets the columns height.
Code example
Initialize a Grid with the columnsheight property specified.
$('#jqxGrid').jqxGrid({ columnsheight: 30});
Get the columnsheight property.
var columnsheight = $('#jqxGrid').jqxGrid('columnsheight');
|
deferreddatafields
|
Array
|
[]
|
Determines the cell values displayed in a tooltip next to the scrollbar when the "scrollmode" is set to "deferred".
Code example
Set the deferreddatafields property .
$("#jqxGrid").jqxGrid(
{
source: adapter,
scrollmode: 'deferred',
deferreddatafields: ['firstname', 'lastname', 'productname'],
columns: [
{ text: 'First Name', datafield: 'firstname', width: 100 },
{ text: 'Last Name', datafield: 'lastname', width: 100 },
{ text: 'Product', datafield: 'productname', width: 180 },
{ text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', datafield: 'price', width: 80, cellsalign: 'right', cellsformat: 'c2' },
{ text: 'Total', datafield: 'total', cellsalign: 'right', cellsformat: 'c2' }
]
});
Get the deferreddatafields property.
var deferreddatafields = $('#jqxGrid').jqxGrid('deferreddatafields');
|
groupsheaderheight
|
Number/String
|
34
|
(requires jqxgrid.grouping.js)
Sets or gets the height of the Grid Groups Header.
Code example
Set the groupsheaderheight property.
$('#jqxGrid').jqxGrid({ groupsheaderheight: 40});
Get the groupsheaderheight property.
var groupsheaderheight = $('#jqxGrid').jqxGrid('groupsheaderheight');
|
groupindentwidth
|
Number
|
20
|
(requires jqxgrid.grouping.js)
Sets or gets the group indent size. This size is used when the grid is grouped. This is the size of the columns with expand/collapse toggle buttons.
Code example
Set the groupindentwidth property.
$('#jqxGrid').jqxGrid({ groupindentwidth: 30});
Get the groupindentwidth property.
var groupindentwidth = $('#jqxGrid').jqxGrid('groupindentwidth');
|
height
|
Number/String
|
400
|
Sets or gets the Grid's height.
Code example
Set the height property.
$('#jqxGrid').jqxGrid({ height: 250 });
Get the height property.
var height = $('#jqxGrid').jqxGrid('height');
|
pagerheight
|
Number/String
|
34
|
(requires jqxgrid.pager.js)
Sets or gets the height of the Grid Pager.
Code example
Set the pagerheight property.
$('#jqxGrid').jqxGrid({ pagerheight: 30});
Get the pagerheight property.
var pagerheight = $('#jqxGrid').jqxGrid('pagerheight');
|
rowsheight
|
Number
|
28
|
Sets or gets the height of the grid rows.
Code example
Set the rowsheight property.
$('#jqxGrid').jqxGrid({ rowsheight: 20});
Get the rowsheight property.
var rowsheight = $('#jqxGrid').jqxGrid('rowsheight');
|
scrollbarsize
|
Number
|
15
|
Sets or gets the scrollbars size.
Code example
Set the scrollbarsize property.
$('#jqxGrid').jqxGrid({ scrollbarsize: 17});
Get the scrollbarsize property.
var scrollbarsize = $('#jqxGrid').jqxGrid('scrollbarsize');
|
scrollmode
|
String
|
"default"
|
Determines the scrolling mode.
Possible Values:
'default'
'logical'- the movement of the scrollbar thumb is by row, not by pixel
'deferred'-content is stationary when the user drags the Thumb of a ScrollBar
Code example
Set the scrollmode property.
$('#jqxGrid').jqxGrid({ scrollmode: 'logical'});
Get the scrollmode property.
var scrollmode = $('#jqxGrid').jqxGrid('scrollmode');
|
scrollfeedback
|
function
|
null
|
When the "scrollmode" is set to "deferred", the "scrollfeedback" function may be used to display custom UI Tooltip next to the scrollbar.
Code example
Set the scrollfeedback function.
$("#jqxgrid").jqxGrid({ source: dataAdapter, altrows: true, sortable: true, scrollmode: 'deferred', scrollfeedback: function(row) { return '<table style="height: 150px;"><tr><td><img src="../../images/t-shirts/' + row.pic + '"/></td></tr><tr><td>' + row.label + '</td></tr></table>'; }, rowsheight: 115, columns: [ { text: 'Image', datafield: 'pic', width: 115, cellsrenderer: function (row, column, value) { return '<img src="../../images/t-shirts/' + value + '"/>'; } }, { text: 'Title', datafield: 'label', width: 250 }, { text: 'Price', cellsformat: 'c2', datafield: 'price' } ]});
Get the scrollfeedback function.
var scrollfeedback = $('#jqxGrid').jqxGrid('scrollfeedback');
|
width
|
Number/String
|
600
|
Sets or gets the Grid's width.
Code example
Set the width property.
$('#jqxGrid').jqxGrid({ width: 250 });
Get the width property.
var width = $('#jqxGrid').jqxGrid('width');
|
|
|
|
|
|
|
|
|
|
Behavior
|
|
|
|
|
|
|
|
|
|
|
|
Name
|
Type
|
Default
|
autosavestate
|
Boolean
|
false
|
(requires jqxgrid.storage.js)
Determines whether the Grid automatically saves its current state.
Code example
Set the autosavestate property.
$("#jqxGrid").jqxGrid({ autosavestate: true});
Get the autosavestate property.
var autosavestate = $('#jqxGrid').jqxGrid('autosavestate');
|
autoloadstate
|
Boolean
|
false
|
(requires jqxgrid.storage.js)
Determines whether the Grid automatically loads its current state(if there's already saved one). The Grid's state is loaded when the page is refreshed.
Code example
Set the autoloadstate property.
$("#jqxGrid").jqxGrid({ autoloadstate: true});
Get the autoloadstate property.
var autoloadstate = $('#jqxGrid').jqxGrid('autoloadstate');
|
columns
|
Array
|
[]
|
Sets the Grid columns.
Code example
Set the columns property.
$("#jqxGrid").jqxGrid(
{
source: source,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Shipped Date', datafield: 'ShippedDate', width: 230, cellsformat: 'D' },
{ text: 'Freight', datafield: 'Freight', width: 130, cellsformat: 'F2', cellsalign: 'right' },
{ text: 'Ship Address', datafield: 'ShipAddress', width: 350 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry', width: 100 }
]
});
Column Properties:
- text - sets the column text.
- datafield - sets the column datafield.
- displayfield - sets the column's displayfield. The displayfield specifies the field in the data source from which the column to retrieve strings for display.
- sortable - enables or disables the sorting.
- filterable - enables or disables the filtering.
- filter - sets the column's initialization filter. A $.jqx.filter object is expected.
- hideable - enables or disables whether the column can be hidden.
- hidden - hides or shows the column.
- groupable - sets whether the user can group by this column.
- menu - sets whether the menu button is displayed when the user moves the mouse cursor over the column's header.
- exportable - determines whether the column will be exported when the Grid's export method is called.
- columngroup - determines the name of the column's parent group.
- enabletooltips - determines whether tooltips are enabled.
- renderer - sets a custom column renderer. This can be used for changing the built-in rendering of the column's header.
- rendered - callback function that is called when the column is rendered. You can use it to set additional settings to the column's header element.
rendered: function (columnHeaderElement) {
// Your code here.
}
- cellsrenderer - sets a custom rendering function. The cellsrenderer function is called when a cell in the column is rendered. You can use it to override the built-in cells rendering. The cellsRenderer function has 6 parameters passed by jqxGrid - row index, data field, cell value, defaultHtml string that is rendered by the grid, column's settings and the entire row's data as JSON object.
{ text: 'Quantity', datafield: 'quantity', width: 70, cellsalign: 'right', columntype: 'numberinput',
cellsrenderer: function (row, columnfield, value, defaulthtml, columnproperties) {
if (value < 20) {
return '' + value + '';
}
else {
return '' + value + '';
}
}
}
- columntype - sets the column's type.
Possible values:
- 'number' - readonly column with numbers.
- 'checkbox' - readonly checkbox when the editing is disabled. Checkbox input when editing is enabled.
- threestatecheckbox - determines whether the checkbox has an indeterminate state when the value is null. The default value is false.
- 'numberinput' - sets a number input editor as a default editor for the column. Requires: jqxnumberinput.js
- 'dropdownlist' - sets a dropdownlist editor as a default editor for the column. Requires: jqxlistbox.js and jqxdropdownlist.js
- 'combobox' - sets a combobox editor as a default editor for the column. Requires: jqxlistbox.js and jqxcombobox.js
- 'datetimeinput' - sets a datetimeinput editor as a default editor for the column. Requires: jquery.global.js, jqxcalendar.js and jqxdatetimeinput.js
- 'textbox' - sets a textbox editor as a default editor for the column.
- 'template' - sets a custom editor as a default editor for the column. The editor should be created in the "createeditor" callback. The editor should be synchronized with the cell's value in the "initeditor" callback. The editor's value should be retrieved in the "geteditorvalue" callback.
- 'custom' - sets a custom editor as a default editor for a cell. That setting enables you to have multiple editors in a Grid column. The editors should be created in the "createeditor" callback - it is called for each row when the "columntype=custom". The editors should be synchronized with the cell's value in the "initeditor" callback. The editor's value should be retrieved in the "geteditorvalue" callback.
- validation - sets a custom validation function. The Grid passes 2 parameters to it - edit cell and the cell's value. The function should return
true or false, depending on the user's validation logic. It can also return a validation object with 2 fields - "result" - true or false, and "message" - validation string displayed to the users.
{ text: 'Quantity', datafield: 'quantity', width: 70, cellsalign: 'right', columntype: 'numberinput',
validation: function (cell, value) {
if (value < 0 || value > 150) {
return { result: false, message: "Quantity should be in the 0-150 interval" };
}
return true;
}
}
- createwidget - sets a custom function which is called when a widget in a cell is created. You can use this callback function to create a custom read-only column which displays widgets in the cells.
The Grid passes 4 parameters to it - row, column, cell value and the cell's element.
{
text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220,
createwidget: function (row, column, value, cellElement) {
// add widget's html element to the cellElement and then create the widget.
}
},
- initwidget - sets a custom function which is called when a widget in a cell needs to be updated. The function is called only if "createwidget" is defined. You can use this callback function to update a widget inside a custom read-only column.
The Grid passes 4 parameters to it - row, column, cell value and the cell's element.
{
text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220,
initwidget: function (row, column, value, cellElement) {
// update the widget by using its cellElement.
}
},
- createfilterwidget - sets a custom function which is called when a widget from the filter row is created. You can use this callback function to set up additional settings of the filter widget.
The Grid passes 3 parameters to it - column, the column's HTML element and the filter widget.
{
text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220,
createfilterwidget: function (column, columnElement, widget) {
widget.jqxDropDownList({ dropDownWidth: 250 });
}
},
- createfilterpanel - sets a custom function for overriding the Grid's Filter Menu. The column's filtertype should be set to "custom" in order to use that option. The grid passes the column's field and filter panel as parameters.
var buildFilterPanel = function (filterPanel, datafield) {
var textInput = $("<input style='margin:5px;'/>");
var applyinput = $("<div class='filter' style='height: 25px; margin-left: 20px; margin-top: 7px;'></div>");
var filterbutton = $('<span tabindex="0" style="padding: 4px 12px; margin-left: 2px;">Filter</span>');
applyinput.append(filterbutton);
var filterclearbutton = $('<span tabindex="0" style="padding: 4px 12px; margin-left: 5px;">Clear</span>');
applyinput.append(filterclearbutton);
filterPanel.append(textInput);
filterPanel.append(applyinput);
filterbutton.jqxButton({ theme: exampleTheme, height: 20 });
filterclearbutton.jqxButton({ theme: exampleTheme, height: 20 });
var dataSource =
{
localdata: adapter.records,
datatype: "array",
async: false
}
var dataadapter = new $.jqx.dataAdapter(dataSource,
{
autoBind: false,
autoSort: true,
autoSortField: datafield,
async: false,
uniqueDataFields: [datafield]
});
textInput.jqxInput({ theme: exampleTheme, placeHolder: "Enter Last Name", popupZIndex: 9999999, displayMember: 'lastname', source: dataadapter, height: 23, width: 175 });
filterbutton.click(function () {
var filtergroup = new $.jqx.filter();
var filter_or_operator = 1;
var filtervalue = textInput.val();
var filtercondition = 'contains';
var filter1 = filtergroup.createfilter('stringfilter', filtervalue, filtercondition);
filtergroup.addfilter(filter_or_operator, filter1);
// add the filters.
$("#jqxgrid").jqxGrid('addfilter', datafield, filtergroup);
// apply the filters.
$("#jqxgrid").jqxGrid('applyfilters');
$("#jqxgrid").jqxGrid('closemenu');
});
filterclearbutton.click(function () {
$("#jqxgrid").jqxGrid('removefilter', datafield);
// apply the filters.
$("#jqxgrid").jqxGrid('applyfilters');
$("#jqxgrid").jqxGrid('closemenu');
});
}
$("#jqxgrid").jqxGrid(
{
width: 850,
source: adapter,
filterable: true,
sortable: true,
ready: function () {
addfilter();
},
autoshowfiltericon: true,
columnmenuopening: function (menu, datafield, height) {
var column = $("#jqxgrid").jqxGrid('getcolumn', datafield);
if (column.filtertype === "custom") {
menu.height(155);
}
else menu.height(height);
},
columns: [
{
text: 'First Name', datafield: 'firstname', width: 160,
filtertype: "custom",
createfilterpanel: function (datafield, filterPanel) {
buildFilterPanel(filterPanel, datafield);
}
},
{
text: 'Last Name', datafield: 'lastname',
filtertype: "custom",
createfilterpanel: function (datafield, filterPanel) {
buildFilterPanel(filterPanel, datafield, );
},
width: 160
},
{ text: 'Product', datafield: 'productname', filtertype: 'checkedlist', width: 170 },
{ text: 'Order Date', datafield: 'date', filtertype: 'date', width: 160, cellsformat: 'dd-MMMM-yyyy' },
{ text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2' }
]
});
- initeditor - sets a custom function which is called when the cells editor is opened. The Grid passes 6 parameters to it - row index, cell value, the editor element, cell's text, the pressed char. The function can be
used for adding some custom parameters to the editor. This function is called each time an editor is opened.
{ text: 'Quantity', datafield: 'quantity', width: 70, cellsalign: 'right', columntype: 'numberinput',
initeditor: function (row, cellvalue, editor, celltext, pressedChar) {
editor.jqxNumberInput({ decimalDigits: 0, digits: 3 });
}
}
- createeditor - sets a custom function which is called when the cells editor is created. The Grid passes 6 parameters to it - row index, cell value, the editor element, cell's text, cell's width and cell's height. The function can be
used for adding some custom parameters to the editor. This function is called only once - when the editor is created.
{ text: 'Product', columntype: 'dropdownlist', datafield: 'productname', width: 177,
createeditor: function (row, cellvalue, editor, celltext, cellwidth, cellheight) {
var dataSource = ['Cappuccino', 'Caramel Latte', 'Caffe Espresso'];
editor.jqxDropDownList({source: dataSource });
}
}
- destroyeditor - sets a custom function which is called when a custom cell editor is destroyed. The function is called only when the "columntype" property is set to "custom "and "template". In all other cases, jqxGrid automatically destroys the editors. The Grid passes 1 parameter to it - the editor element. If the "columntype" is "custom", the Grid passes the row's bound index as a second parameter.
- geteditorvalue - gets the editor's value to be displayed in the cell. The function can be used for overriding the value returned by the editor. It is useful for advanced scenarios with custom editors and edit templates. The Grid passes 3 parameters to it - row's bound index index, cell value and the editor element.
geteditorvalue: function (row, cellvalue, editor) {
// return the editor's value.
return editor.find('input').val();
}
- cellbeginedit - sets a custom function which is called when a cell enters into edit mode. The Grid passes 3 parameters to it - row index, column data field and column type. The function can be
used for canceling the editing of a specific Grid cell. To cancel the editing, the function should return false.
{ text: 'Product', columntype: 'dropdownlist', datafield: 'productname', width: 177,
cellbeginedit: function (row, datafield, columntype) {
if (row == 2)
return false;
}
}
- cellendedit - sets a custom function which is called when a cell leaves the edit mode. The Grid passes 5 parameters to it - row index, column data field, column type, old cell value, new cell value. The function can be
used for canceling the changes of a specific Grid cell. To cancel the changes, the function should return false.
{ text: 'Product', datafield: 'productname',
cellendedit: function (row, datafield, columntype, oldvalue, newvalue) {
if (newvalue == "My Value")
return false;
}
}
- cellvaluechanging - sets a custom function which is called when a cell's value is going to be changed The Grid passes 5 parameters to it - row index, column data field, column type, old cell value, new cell value. The function can be
used for modifying the edited value.
{
text: 'First Name', columntype: 'textbox', datafield: 'firstname', width: 90,
cellvaluechanging: function (row, datafield, columntype, oldvalue, newvalue) {
return "$" + newvalue;
}
},
- createeverpresentrowwidget - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) is created. datafield is the column's datafield. htmlElement is the Cell's DIV tag. popup is the popup displayed below the cell. addRowCallback is a function which you can call to trigger the "Add" action.
{ text: 'Product', datafield: 'productname',
createEverPresentRowWidget: function (datafield, htmlElement, popup, addRowCallback) {
var inputTag = $("<input style='border: none;'/>").appendTo(htmlElement);
inputTag.jqxInput({ popupZIndex: 99999999, placeHolder: "Enter Name: ", source: getSourceAdapter("name"), displayMember: 'name', width: '100%', height: 30 });
var everpresentrowheight = $("#jqxgrid").jqxGrid('everpresentrowheight');
inputTag.focus(function () {
popup.css({ display: 'block', top: inputTag.offset().top + everpresentrowheight - 1, left: inputTag.offset().left });
});
inputTag.blur(function () {
popup.hide();
});
return inputTag;
}
}
- initeverpresentrowwidget - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) is being initialized.
{ text: 'Product', datafield: 'productname',
initeverpresentrowwidget: function (datafield, htmlElement, popup) {
}
}
- reseteverpresentrowwidgetvalue - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) should reset its value.
{ text: 'Product', datafield: 'productname',
reseteverpresentrowwidgetvalue: function (htmlElement) {
}
}
- geteverpresentrowwidgetvalue - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) should return its value.
{ text: 'Product', datafield: 'productname',
getEverPresentRowWidgetValue: function (datafield, htmlElement) {
var value = htmlElement.val();
return value;
},
}
- destroyeverpresentrowwidget - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) is destroyed. The function is useful for destroying custom widgets.
{ text: 'Product', datafield: 'productname',
destroyeverpresentrowwidget: function (htmlElement) {
}
}
- validateeverpresentrowwidgetvalue - sets a custom function which is called when a widget in the ever present row(showeverpresentrow should be true) should validate its value.
{text: 'Product', datafield: 'productname',
validateeverpresentrowwidgetvalue: function (datafield, value. rowValues) {
if (value.length < 5) {
return { message: "Value is Short", result: false };
}
return true;
}
- cellsformat - sets the formatting of the grid cells.
Possible Number strings:
"d" - decimal numbers.
"f" - floating-point numbers.
"n" - integer numbers.
"c" - currency numbers.
"p" - percentage numbers.
For adding decimal places to the numbers, add a number after the formatting string.
For example: "c3" displays a number in this format $25.256
Possible built-in Date formats:
// short date pattern
d: "M/d/yyyy",
// long date pattern
D: "dddd, MMMM dd, yyyy",
// short time pattern
t: "h:mm tt",
// long time pattern
T: "h:mm:ss tt",
// long date, short time pattern
f: "dddd, MMMM dd, yyyy h:mm tt",
// long date, long time pattern
F: "dddd, MMMM dd, yyyy h:mm:ss tt",
// month/day pattern
M: "MMMM dd",
// month/year pattern
Y: "yyyy MMMM",
// S is a sortable format that does not vary by culture
S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss"
Possible Date format strings:
"d"-the day of the month;
"dd"-the day of the month;
"ddd"-the abbreviated name of the day of the week;
"dddd"- the full name of the day of the week;
"h"-the hour, using a 12-hour clock from 1 to 12;
"hh"-the hour, using a 12-hour clock from 01 to 12;
"H"-the hour, using a 24-hour clock from 0 to 23;
"HH"- the hour, using a 24-hour clock from 00 to 23;
"m"-the minute, from 0 through 59;
"mm"-the minutes,from 00 though59;
"M"- the month, from 1 through 12;
"MM"- the month, from 01 through 12;
"MMM"-the abbreviated name of the month;
"MMMM"-the full name of the month;
"s"-the second, from 0 through 59;
"ss"-the second, from 00 through 59;
"t"- the first character of the AM/PM designator;
"tt"-the AM/PM designator;
"y"- the year, from 0 to 99;
"yy"- the year, from 00 to 99;
"yyy"-the year, with a minimum of three digits;
"yyyy"-the year as a four-digit number;
"yyyyy"-the year as a four-digit number.
- aggregates
Code Example
{ text: 'Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2', aggregates: ['sum', 'avg'] }
Aggregate functions:
- 'avg' - Average aggregate
- 'count' - Count aggregate
- 'min' - Min aggregate
- 'max' - Max aggregate
- 'sum' - Sum aggregate
- 'product' - Product aggregate
- 'stdev' - Standard deviation on a sample.
- 'stdevp' - Standard deviation on an entire population.
- 'varp' - Variance on an entire population.
- 'var' - Variance on a sample.
Custom Aggregate
aggregates: [{ 'In Stock':
function (aggregatedValue, currentValue) {
if (currentValue) {
return aggregatedValue + 1;
}
return aggregatedValue;
}
}
Custom Aggregate which aggregates values from two columns
{ text: 'Price', datafield: 'price', cellsalign: 'right', cellsformat: 'c2', aggregates: [{ 'Total':
function (aggregatedValue, currentValue, column, record) {
var total = currentValue * parseInt(record['quantity']);
return aggregatedValue + total;
}
}]
}
'In Stock' - the aggregate's display name.
The function has 2 params - the aggregated value and the current value. It should return an aggregated value.
- aggregatesrenderer - sets a custom rendering function of the column's aggregates. The function gets passed one parameter - the column's aggregates.
{ text: 'Quantity', datafield: 'quantity', width: 85, cellsalign: 'right', cellsformat: 'n2', aggregates: ['min', 'max'],
aggregatesrenderer: function (aggregates) {
var renderstring = "";
$.each(aggregates, function (key, value) {
var name = key == 'min' ? 'Min' : 'Max';
renderstring += '' + name + ': ' + value +' ';
});
return renderstring;
}
}
- align - sets the column header's alignment to 'left', 'center' or 'right'
- cellsalign - sets the cells alignment to 'left', 'center' or 'right'.
- width - sets the column width.
- minwidth - sets the column's min width.
- maxwidth - sets the column's max width.
- resizable - enables or disables the column resizing.
- draggable - enables or disables the column dragging
- editable - enables or disables the cells editing
- classname - sets a custom CSS class for the column's header
- cellclassname - sets a custom CSS class for the column's cells. The value could be a "String" or "Function".
Apply a CSS class to all cells in the column.
text: 'Ship Name', datafield: 'ShipName', width: 150, cellclassname: "yellowCell"
Apply a conditional CSS depending on the cell's value.
text: 'Ship Name', datafield: 'ShipName', width: 150,
cellclassname: function (row, column, value, data) {
if (value == "Hanari Carnes") {
return "yellowCell";
}
}
- pinned - pins or unpins the column. If the column is pinned, it will be displayed as frozen and will be visible when the user horizontally scrolls the grid contents.
- nullable - enables or disables whether null values are allowed.
- filteritems - sets the items displayed in the list filter - when the "showfilterrow" property value is true and the filter's type is "list" or "checkedlist". The expected value is Array or jqxDataAdapter instance.
- filterdelay - sets the auto-filter timeout delay for 'text' and 'number' filters in the filter row. Default value: 800
- filtertype - sets the filter's type.
- 'textbox' - basic text field.
- 'input' - input field with dropdownlist for choosing the filter condition. *Only when "showfilterrow" is true.
- 'checkedlist' - dropdownlist with checkboxes that specify which records should be visible and hidden.
- 'list' - dropdownlist which specifies the visible records depending on the selection.
- 'number' - numeric input field. *Only when "showfilterrow" is true.
- 'checkbox' - filter for boolean data. *Only when "showfilterrow" is true.
- 'date' - filter for dates.
- 'range' - filter for date ranges. *Only when "showfilterrow" is true.
- 'custom' - allows you to create custom filter menu widgets. *Only when "showfilterrow" is false.
$("#jqxgrid").jqxGrid(
{
width: 670,
source: dataAdapter,
columnsresize: true,
showfilterrow: true,
filterable: true,
selectionmode: 'singlecell',
columns: [
{ text: 'Name', columntype: 'textbox', datafield: 'name', width: 120 },
{ text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 160 },
{ text: 'Available', datafield: 'available', columntype: 'checkbox', filtertype: 'bool', width: 67 },
{ text: 'Ship Date', datafield: 'date', filtertype: 'date', width: 180, cellsalign: 'right', cellsformat: 'd' },
{ text: 'Qty.', datafield: 'quantity', filtertype: 'number', width: 50, cellsalign: 'right' },
{ text: 'Price', datafield: 'price', filtertype: 'number', cellsalign: 'right', cellsformat: 'c2' }
]
});
- filtercondition - determines the filter condition of columns with filtertype equal to 'textbox' or 'number'.
// possible conditions for string filter: 'EMPTY', 'NOT_EMPTY', 'CONTAINS', 'CONTAINS_CASE_SENSITIVE',
// 'DOES_NOT_CONTAIN', 'DOES_NOT_CONTAIN_CASE_SENSITIVE', 'STARTS_WITH', 'STARTS_WITH_CASE_SENSITIVE',
// 'ENDS_WITH', 'ENDS_WITH_CASE_SENSITIVE', 'EQUAL', 'EQUAL_CASE_SENSITIVE', 'NULL', 'NOT_NULL'
// possible conditions for numeric filter: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'
$("#jqxgrid").jqxGrid(
{
source: dataAdapter,
showfilterrow: true,
filterable: true,
columns: [
{ text: 'Name', columntype: 'textbox', filtertype: 'textbox', filtercondition: 'starts_with', datafield: 'name', width: 120 },
{ text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 160 },
{ text: 'Available', datafield: 'available', columntype: 'checkbox', filtertype: 'bool', width: 67 },
{ text: 'Ship Date', datafield: 'date', filtertype: 'date', width: 180, cellsalign: 'right', cellsformat: 'd' },
{ text: 'Qty.', datafield: 'quantity', filtertype: 'number', filtercondition: 'equal', width: 50, cellsalign: 'right' },
{ text: 'Price', datafield: 'price', filtertype: 'number', cellsalign: 'right', cellsformat: 'c2' }
]
});
|
columngroups
|
Array
|
[]
|
The columngroups property enables you to create a Grid with multi column headers.
Possible values for each array entry:
- parentgroup - sets the column header's parent group name.
- name - sets the column header's name.
- align - sets the column header's alignment to 'left', 'center' or 'right'.
Code example
$("#jqxgrid").jqxGrid(
{
source: dataAdapter,
pageable: true,
autorowheight: true,
altrows: true,
columnsresize: true,
columns: [
{ text: 'Supplier Name', cellsalign: 'center', align: 'center', datafield: 'SupplierName', width: 110 },
{ text: 'Name', columngroup: 'ProductDetails', cellsalign: 'center', align: 'center', datafield: 'ProductName', width: 120 },
{ text: 'Quantity', columngroup: 'ProductDetails', datafield: 'Quantity', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 80 },
{ text: 'Freight', columngroup: 'OrderDetails', datafield: 'Freight', cellsformat: 'd', cellsalign: 'center', align: 'center', width: 100 },
{ text: 'OrderDate', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', cellsformat: 'd', datafield: 'OrderDate', width: 100 },
{ text: 'OrderAddress', columngroup: 'OrderDetails', cellsalign: 'center', align: 'center', datafield: 'OrderAddress', width: 120 },
{ text: 'Price', columngroup: 'ProductDetails', datafield: 'Price', cellsformat: 'c2', align: 'center', cellsalign: 'center', width: 70 },
{ text: 'Address', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'Address', width: 120 },
{ text: 'City', columngroup: 'Location', cellsalign: 'center', align: 'center', datafield: 'City', width: 80 }
],
columngroups:
[
{ text: 'Product Details', align: 'center', name: 'ProductDetails' },
{ text: 'Order Details', parentgroup: 'ProductDetails', align: 'center', name: 'OrderDetails' },
{ text: 'Location', align: 'center', name: 'Location' }
]
});
|
columnsmenu
|
Boolean
|
true
|
(requires jqxmenu.js)
Enables or disables the columns dropdown menu.
Code example
Set the columnsmenu property.
$('#jqxGrid').jqxGrid({ columnsmenu: false});
Get the columnsmenu property.
var columnsmenu = $('#jqxGrid').jqxGrid('columnsmenu');
|
columnsresize
|
Boolean
|
false
|
(requires jqxgrid.columnsresize.js)
Enables or disables the columns resizing.
Code example
Set the columnsresize property.
$('#jqxGrid').jqxGrid({ columnsresize: false});
Get the columnsresize property.
var columnsresize = $('#jqxGrid').jqxGrid('columnsresize');
|
columnsautoresize
|
Boolean
|
true
|
(requires jqxgrid.columnsresize.js)
Enables or disables the columns resizing when the column's border is double-clicked and columnsresize is set to true.
Code example
Set the columnsautoresize property.
$('#jqxGrid').jqxGrid({ columnsautoresize: false});
Get the columnsautoresize property.
var columnsautoresize = $('#jqxGrid').jqxGrid('columnsautoresize');
|
columnsreorder
|
Boolean
|
false
|
(requires jqxgrid.columnsreorder.js)
Enables or disables the columns reordering.
Code example
Set the columnsreorder property.
$('#jqxGrid').jqxGrid({ columnsreorder: true});
Get the columnsreorder property.
var columnsreorder = $('#jqxGrid').jqxGrid('columnsreorder');
|
disabled
|
Boolean
|
false
|
Enables or disables the Grid's plugin.
Code example
Set the disabled property.
$("#jqxGrid").jqxGrid({ disabled: true});
Get the disabled property.
var disabled = $('#jqxGrid').jqxGrid('disabled');
|
editable
|
Boolean
|
false
|
(requires jqxgrid.edit.js)
The editable property enables or disables the Grid editing feature.
Code example
Set the editable property.
$('#jqxGrid').jqxGrid({ editable: true});
Get the editable property.
var editable = $('#jqxGrid').jqxGrid('editable');
|
editmode
|
String
|
'selectedcell'
|
(requires jqxgrid.edit.js)
The editmode property specifies the action that the end-user should make to open an editor.
Possible Values:
'click' - Marks the clicked cell as selected and shows the editor. The editor’s value is equal to the cell’s value
'selectedcell' - Marks the cell as selected. A second click on the selected cell shows the editor. The editor’s value is equal to the cell’s value
'selectedrow' - A second click on a selected row shows the row editors.
'dblclick' - Marks the clicked cell as selected and shows the editor. The editor’s value is equal to the cell’s value
'programmatic' - Cell editors are activated and deactivated only through the API(see begincelledit and endcelledit methods)
Code example
Set the editmode property.
$('#jqxGrid').jqxGrid({ editmode: 'click'});
Get the editmode property.
var editmode = $('#jqxGrid').jqxGrid('editmode');
|
filter
|
Function
|
null
|
(requires jqxgrid.filter.js)
Custom Filtering function. It overrides the built-in Filtering. When the user filters, the Grid calls this function, when it is implemented. The function is expected to return a boolean value or undefined.
cellValue, rowData, dataField, filterGroup, defaultFilterResult
- cellValue - current cell's value.
- rowData - JSON object which contains the current row's data.
- dataField - filter column's field.
- filterGroup - group of filters.
- defaultFilterResult - the default filter result.
Code example
Set the filter property.
$("#jqxgrid").jqxGrid(
{
width: 850,
source: dataAdapter,
filterable: true,
// cellValue - cell's current value, row data - row's data, data field - column's data field, filterGroup - group of filters, defaultFilterResult - the built-in boolean evaluated result-
filter: function(cellValue, rowData, dataField, filterGroup, defaultFilterResult)
{
// implements a custom filter for the "name" field.
if (dataField === "name") {
var filters = filterGroup.getfilters();
for (var i = 0; i < filters.length; i++) {
var filter = filters[i];
var filterValue = filter.value;
var filterCondition = filter.condition;
var filterType = filter.type;
if (cellValue.indexOf("Antoni") >= 0) {
return true;
}
if (cellValue.indexOf("Nancy") >= 0) {
return true;
}
}
return false;
}
},
selectionmode: 'multiplecellsextended',
columns: [
{ text: 'Name', columntype: 'textbox', filtertype: 'input', datafield: 'name', width: 215 },
{
text: 'Product', filtertype: 'checkedlist', datafield: 'productname', width: 220
},
{ text: 'Available', datafield: 'available', columntype: 'checkbox', filtertype: 'bool', width: 67 },
{ text: 'Ship Date', datafield: 'date', filtertype: 'range', width: 210, cellsalign: 'right', cellsformat: 'd' },
{ text: 'Qty.', datafield: 'quantity', filtertype: 'number', cellsalign: 'right' }
]
});
Get the filter property.
var filter = $('#jqxGrid').jqxGrid('filter');
|
filterable
|
Boolean
|
false
|
(requires jqxgrid.filter.js)
Enables or disables the Grid Filtering feature. When the value of this property is true,
the Grid displays a filtering panel in the columns popup menus.
Code example
Set the filterable property.
$('#jqxGrid').jqxGrid({ filterable: true});
Get the filterable property.
var filterable = $('#jqxGrid').jqxGrid('filterable');
|
groupable
|
Boolean
|
false
|
(requires jqxgrid.grouping.js)
This property enables or disables the grouping feature.
Code example
Set the groupable property.
$('#jqxGrid').jqxGrid({ groupable: true});
Get the groupable property.
var groupable = $('#jqxGrid').jqxGrid('groupable');
|
groups
|
Array
|
[]
|
(requires jqxgrid.grouping.js)
Sets or gets the Grid groups when the Grouping feature is enabled.
Code example
Set the groups property.
$("#jqxGrid").jqxGrid(
{
source: source,
columns: [
{ text: 'Ship Name', datafield: 'ShipName', width: 250 },
{ text: 'Ship City', datafield: 'ShipCity', width: 100 },
{ text: 'Ship Country', datafield: 'ShipCountry' }
],
groupable: true,
groups: ['ShipCity']
});
Get the groups property.
var groups = $('#jqxGrid').jqxGrid('groups');
|
horizontalscrollbarstep
|
Number
|
5
|
Sets or gets the scrollbar's step when the user clicks the scroll arrows.
Code example
Set the horizontalscrollbarstep property.
$("#jqxGrid").jqxGrid({ horizontalscrollbarstep: 15});
Get the horizontalscrollbarstep property.
var horizontalscrollbarstep = $('#jqxGrid').jqxGrid('horizontalscrollbarstep');
|
horizontalscrollbarlargestep
|
Number
|
50
|
Sets or gets the scrollbar's large step. This property specifies the step with which the horizontal scrollbar's
value is changed when the user clicks the area above or below the thumb.
Code example
Set the horizontalscrollbarlargestep property.
$("#jqxGrid").jqxGrid({ horizontalscrollbarlargestep: 50});
Get the horizontalscrollbarlargestep property.
var horizontalscrollbarlargestep = $('#jqxGrid').jqxGrid('horizontalscrollbarlargestep');
|
initrowdetails
|
function
|
null
|
This function is called when the user expands the row details and the details are going to be rendered.
Code example
Set the initrowdetails function.
var initrowdetails = function (index) {
// your row details initialization code here. The index is the index of the expanded row with details.
}
$('#jqxGrid').jqxGrid({ initrowdetails: initrowdetails});
Get the initrowdetails function.
var initrowdetails = $('#jqxGrid').jqxGrid('initrowdetails');
|
keyboardnavigation
|
Boolean
|
true
|
(requires jqxgrid.selection.js)
Enables or disables the keyboard navigation.
Code example
Set the keyboardnavigation property.
$("#jqxGrid").jqxGrid({ keyboardnavigation: false});
Get the keyboardnavigation property.
var keyboardnavigation = $('#jqxGrid').jqxGrid('keyboardnavigation');
|
pagesize
|
Number
|
10
|
(requires jqxgrid.pager.js)
Sets or gets the number of visible rows per page when the Grid paging is enabled.
Code example
Set the pagesize property.
$('#jqxGrid').jqxGrid({ pagesize: 20});
Get the pagesize property.
var pagesize = $('#jqxGrid').jqxGrid('pagesize');
|
pagesizeoptions
|
Array
|
['5', '10', '20']
|
(requires jqxgrid.pager.js)
Sets or gets the available page size options.
Code example
Set the pagesizeoptions property.
$('#jqxGrid').jqxGrid({ pagesizeoptions: ['10', '20', '30']});
Get the pagesizeoptions property.
var pagesizeoptions = $('#jqxGrid').jqxGrid('pagesizeoptions');
|
pagermode
|
String
|
"default"
|
(requires jqxgrid.pager.js)
Sets or gets the rendering mode of the pager. Available values - "simple" and "default".
Code example
Set the pagermode property.
$('#jqxGrid').jqxGrid({ pagermode: "simple"});
Get the pagermode property.
var pagermode = $('#jqxGrid').jqxGrid('pagermode');
|
pagerbuttonscount
|
Number
|
5
|
(requires jqxgrid.pager.js)
Sets or gets the buttons displayed in the pager when the "pagermode" is set to "simple".
Code example
Set the pagerbuttonscount property.
$('#jqxGrid').jqxGrid({ pagerbuttonscount: 3});
Get the pagerbuttonscount property.
var pagerbuttonscount = $('#jqxGrid').jqxGrid('pagerbuttonscount');
|
pageable
|
Boolean
|
false
|
(requires jqxgrid.pager.js)
Enables or disables the Grid Paging feature. When the value of this property is true,
the Grid displays a pager below the rows.
Code example
Set the pageable property.
$('#jqxGrid').jqxGrid({ pageable: true});
Get the pageable property.
var pageable = $('#jqxGrid').jqxGrid('pageable');
|
rowdetails
|
Boolean
|
false
|
Enables or disables the row details. When this option is enabled, the Grid can show additional information below each grid row.
Code example
Set the rowdetails property.
$('#jqxGrid').jqxGrid({ rowdetails: true});
Get the rowdetails property.
var rowdetails = $('#jqxGrid').jqxGrid('rowdetails');
|
rowdetailstemplate
|
Object
|
null
|
Determines the template of the row details. The rowdetails field specifies the HTML used for details. The rowdetailsheight specifies the height of the details.
Code example
Set the rowdetailstemplate property.
$('#jqxGrid').jqxGrid({ rowdetailstemplate: { rowdetails: "<div style='margin: 10px;'><ul style='margin-left: 30px;'><li class='title'></li><li>Notes</li></ul><div class='information'></div><div class='notes'></div></div> ", rowdetailsheight: 200 });
Get the rowdetailstemplate property.
var rowdetailstemplate = $('#jqxGrid').jqxGrid('rowdetailstemplate');
|
ready
|
function
|
null
|
This function is called when the grid is initialized and the binding is complete.
Code example
Set the ready function.
$("#jqxgrid").jqxGrid(
{
source: source,
ready: function()
{
$("#jqxGrid").jqxGrid('sortby', 'firstname', 'asc');
},
columns: [
{ text: 'First Name', datafield: 'firstname', width: 100 },
{ text: 'Last Name', datafield: 'lastname', width: 100 },
{ text: 'Product', datafield: 'productname', width: 180 },
{ text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
{ text: 'Total', datafield: 'total', cellsalign: 'right', cellsformat: 'c2' }
]
});
Get the ready function.
var ready = $('#jqxGrid').jqxGrid('ready');
|
rendered
|
function
|
null
|
Callback function which is called when the jqxGrid's render function is called either internally or not.
Code example
Set the rendered property.
$('#jqxGrid').jqxGrid({ rendered: function(){//to do}});
Get the rendered property.
var rendered = $('#jqxGrid').jqxGrid('rendered');
|
renderstatusbar
|
function
|
null
|
Callback function which allows you to customize the rendering of the Grid's statusbar.
Code example
Set the renderstatusbar property.
$('#jqxGrid').jqxGrid({ renderstatusbar: function(statusbar){//to do}});
Get the renderstatusbar property.
var renderstatusbar = $('#jqxGrid').jqxGrid('renderstatusbar');
|
rendertoolbar
|
function
|
null
|
Callback function which allows you to customize the rendering of the Grid's toolbar.
Code example
Set the rendertoolbar property.
$('#jqxGrid').jqxGrid({ rendertoolbar: function(toolbar){//to do}});
Get the rendertoolbar property.
var rendertoolbar = $('#jqxGrid').jqxGrid('rendertoolbar');
|
rendergridrows
|
function
|
null
|
This is a function called when the grid is used in virtual mode. The function should return an array of rows which will be rendered by the Grid.
Code example
Set the rendergridrows function.
// prepare the data
var data = new Array();
var firstNames =
[
"Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"
];
var lastNames =
[
"Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"
];
var productNames =
[
"Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"
];
var priceValues =
[
"2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"
];
// generate sample data.
var generatedata = function (startindex, endindex) {
var data = {};
for (var i = startindex; i < endindex; i++) {
var row = {};
var productindex = Math.floor(Math.random() * productNames.length);
var price = parseFloat(priceValues[productindex]);
var quantity = 1 + Math.round(Math.random() * 10);
row["id"] = i;
row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
row["productname"] = productNames[productindex];
row["price"] = price;
row["quantity"] = quantity;
row["total"] = price * quantity;
data[i] = row;
}
return data;
}
var source =
{
datatype: "array",
localdata: {},
totalrecords: 1000000
};
// load virtual data.
var rendergridrows = function (params) {
var data = generatedata(params.startindex, params.endindex);
return data;
}
Get the rendergridrows property.
var rendergridrows = $('#jqxGrid').jqxGrid('rendergridrows');
|
sortable
|
Boolean
|
false
|
(requires jqxgrid.sort.js)
The sortable property enables or disables the sorting feature.
Code example
Set the sortable property.
$('#jqxGrid').jqxGrid({ sortable: true});
Get the sortable property.
var sortable = $('#jqxGrid').jqxGrid('sortable');
|
selectedrowindex
|
Number
|
-1
|
(requires jqxgrid.selection.js)
Selects a row at a specified index.
Code example
Set the selectedrowindex property.
$('#jqxGrid').jqxGrid({ selectedrowindex: 1});
Get the selectedrowindex property.
var selectedrowindex = $('#jqxGrid').jqxGrid('selectedrowindex');
|
selectedrowindexes
|
Array
|
[]
|
(requires jqxgrid.selection.js)
Selects single or multiple rows.
Code example
Set the selectedrowindexes property.
$('#jqxGrid').jqxGrid({ selectedrowindexes: [0, 1, 2]});
Get the selectedrowindexes property.
var selectedrowindexes = $('#jqxGrid').jqxGrid('selectedrowindexes');
|
source
|
Object
|
{}
|
(requires jqxdata.js)
The source object represents a set of key/value pairs.
url: A string containing the URL to which the request is sent.
data: Data to be sent to the server.
localdata: data array or data string pointing to a local data source.
datatype: the data's type. Possible values: 'xml', 'json', 'jsonp', 'tsv', 'csv', 'local', 'array', 'observablearray'.
type: The type of request to make ("POST" or "GET"), default is "GET".
id: A string containing the Id data field.
root: A string describing where the data begins and all other loops begin from this element.
record: A string describing the information for a particular record.
var source =
{
datatype: "xml",
datafields: [
{ name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' },
{ name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' },
{ name: 'ShipName', map: 'm\\:properties>d\\:ShipName' },
{ name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' },
{ name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' },
{ name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }
],
root: "entry",
record: "content",
id: 'm\\:properties>d\\:OrderID',
url: 'orders.xml'
};
XML
<entry>
<id>http://services.odata.org/Northwind/Northwind.svc/Orders(10248)</id>
<title type="text"></title>
<updated>2011-12-01T11:55:06Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Order" href="Orders(10248)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="Orders(10248)/Customer" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Employee" type="application/atom+xml;type=entry" title="Employee" href="Orders(10248)/Employee" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Orders(10248)/Order_Details" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Shipper" type="application/atom+xml;type=entry" title="Shipper" href="Orders(10248)/Shipper" />
<category term="NorthwindModel.Order" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:OrderID m:type="Edm.Int32">10248</d:OrderID>
<d:CustomerID>VINET</d:CustomerID>
<d:EmployeeID m:type="Edm.Int32">5</d:EmployeeID>
<d:OrderDate m:type="Edm.DateTime">1996-07-04T00:00:00</d:OrderDate>
<d:RequiredDate m:type="Edm.DateTime">1996-08-01T00:00:00</d:RequiredDate>
<d:ShippedDate m:type="Edm.DateTime">1996-07-16T00:00:00</d:ShippedDate>
<d:ShipVia m:type="Edm.Int32">3</d:ShipVia>
<d:Freight m:type="Edm.Decimal">32.3800</d:Freight>
<d:ShipName>Vins et alcools Chevalier</d:ShipName>
<d:ShipAddress>59 rue de l'Abbaye</d:ShipAddress>
<d:ShipCity>Reims</d:ShipCity>
<d:ShipRegion m:null="true" />
<d:ShipPostalCode>51100</d:ShipPostalCode>
<d:ShipCountry>France</d:ShipCountry>
</m:properties>
</content>
</entry>
<entry>
<id>http://services.odata.org/Northwind/Northwind.svc/Orders(10249)</id>
<title type="text"></title>
<updated>2011-12-01T11:55:06Z</updated>
<author>
<name />
</author>
<link rel="edit" title="Order" href="Orders(10249)" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Customer" type="application/atom+xml;type=entry" title="Customer" href="Orders(10249)/Customer" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Employee" type="application/atom+xml;type=entry" title="Employee" href="Orders(10249)/Employee" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Order_Details" type="application/atom+xml;type=feed" title="Order_Details" href="Orders(10249)/Order_Details" />
<link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/Shipper" type="application/atom+xml;type=entry" title="Shipper" href="Orders(10249)/Shipper" />
<category term="NorthwindModel.Order" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:OrderID m:type="Edm.Int32">10249</d:OrderID>
<d:CustomerID>TOMSP</d:CustomerID>
<d:EmployeeID m:type="Edm.Int32">6</d:EmployeeID>
<d:OrderDate m:type="Edm.DateTime">1996-07-05T00:00:00</d:OrderDate>
<d:RequiredDate m:type="Edm.DateTime">1996-08-16T00:00:00</d:RequiredDate>
<d:ShippedDate m:type="Edm.DateTime">1996-07-10T00:00:00</d:ShippedDate>
<d:ShipVia m:type="Edm.Int32">1</d:ShipVia>
<d:Freight m:type="Edm.Decimal">11.6100</d:Freight>
<d:ShipName>Toms Spezialitäten</d:ShipName>
<d:ShipAddress>Luisenstr. 48</d:ShipAddress>
<d:ShipCity>Münster</d:ShipCity>
<d:ShipRegion m:null="true" />
<d:ShipPostalCode>44087</d:ShipPostalCode>
<d:ShipCountry>Germany</d:ShipCountry>
</m:properties>
</content>
</entry>
datafields: An array describing the fields in a particular record. Each datafield must define the following members:
name - A string containing the data field's name.
type(optional) - A string containing the data field's type. Possible values: 'string', 'date', 'number', 'bool'.
format(optional) - Sets the data formatting. By setting the format, the jqxDataAdapter plug-in will try to format the data before loading it.
Example: { name: 'SubmitDate', type: 'date', format: "yyyy-MM-ddTHH:mm:ss-HH:mm" }
map(optional) - A mapping to the data field.
Example with XML data:
{ name: 'CompanyName', map: 'm\\:properties>d\\:CompanyName' }
XML
<content type="application/xml">
<m:properties>
<d:CustomerID>ALFKI</d:CustomerID>
<d:CompanyName>Alfreds Futterkiste</d:CompanyName>
<d:ContactName>Maria Anders</d:ContactName>
<d:ContactTitle>Sales Representative</d:ContactTitle>
<d:Address>Obere Str. 57</d:Address>
<d:City>Berlin</d:City>
<d:Region m:null="true" />
<d:PostalCode>12209</d:PostalCode>
<d:Country>Germany</d:Country>
<d:Phone>030-0074321</d:Phone>
<d:Fax>030-0076545</d:Fax>
</m:properties>
</content>
Example with nested JSON data.
var data = [{ "empName": "test", "age": "67", "department": { "id": "1234", "name": "Sales" }, "author": "ravi"}];
// prepare the data
var source =
{
datatype: "json",
datafields: [
{ name: 'empName' },
{ name: 'age' },
{ name: 'id', map: 'department>id' },
{ name: 'name', map: 'department>name' },
{ name: 'author' }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);
Example #2 with nested JSON data.
var data = [
{
"state": {
"id": "x526",
"city": {
"name": "Beverly Hills",
"id": 90210,
"value": "Beverly Hills"
}
}
}
];
var source = {
datatype: 'json',
localdata: data,
datafields:
[
{
name: 'cityName', map: 'state>city>name'
}
]
};
var dataAdapter = new $.jqx.dataAdapter(source);
id - determines the id of a record in a foreign collection which should match to the record's name in the source collection.
text - determines the display field from the foreign collection.
source - determines the foreign collection associated to the data field. The expected value is an array.
Example with using the id, text and source. This functionality allows you to join two or more data sources.
// load records from employees.xml into a dataAdapter.
var employeesSource =
{
datatype: "xml",
datafields: [
{ name: 'FirstName' },
{ name: 'LastName' }
],
root: "Employees",
record: "Employee",
id: 'EmployeeID',
url: "../sampledata/employees.xml",
async: false
};
// create dataAdapter from the employeesSource object.
var employeesAdapter = new $.jqx.dataAdapter(employeesSource, {
autoBind: true,
beforeLoadComplete: function (records) {
var data = new Array();
// update the loaded records. Dynamically add EmployeeName field.
for (var i = 0; i < records.length; i++) {
var employee = records[i];
employee.EmployeeName = employee.FirstName + " " + employee.LastName;
data.push(employee);
}
return data;
}
});
// load records from orders.xml into a dataAdapter.
var ordersSource =
{
datatype: "xml",
datafields: [
// id - determines the id of a record in the foreign collection(employees.xml) which should match to the record's name in the source collection(orders.xml). The 'EmployeeID' from the employees.xml must match to 'EmployeeID' from the orders.xml.
// text - determines the display field from the foreign collection. We set it to 'EmployeeName' because we want to display the employee names in that column.
// source - determines the foreign collection. In this scenario, that's the employees data source.
{ name: 'EmployeeID', map: 'm\\:properties>d\\:EmployeeID', text: 'EmployeeName', id: 'EmployeeID', source: employeesAdapter.records },
{ name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' },
{ name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' },
{ name: 'ShipName', map: 'm\\:properties>d\\:ShipName' },
{ name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' },
{ name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' },
{ name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }
],
root: "entry",
record: "content",
id: 'm\\:properties>d\\:OrderID',
url: "../sampledata/orders.xml",
pager: function (pagenum, pagesize, oldpagenum) {
// callback called when a page or page size is changed.
}
};
var ordersAdapter = new $.jqx.dataAdapter(ordersSource);
pagenum - determines the initial page number when paging is enabled.
pagesize - determines the page size when paging is enabled.
pager - callback function called when the current page or page size is changed.
pager: function (pagenum, pagesize, oldpagenum) {
}
sortcolumn - determines the initial sort column. The expected value is a data field name.
sortdirection - determines the sort order. The expected value is 'asc' for (A to Z) sorting or 'desc' for (Z to A) sorting.
sort - callback function called when the sort column or sort order is changed.
sort: function (column, direction) {
}
filter - callback function called when a filter is applied or removed.
filter: function(filters, recordsArray)
{
}
addrow - callback function, called when a new row is/are added. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows.
addrow: function (rowid, rowdata, position, commit) {
// synchronize with the server - send insert command
// call commit with parameter true if the synchronization with the server is successful
//and with parameter false if the synchronization failed.
commit(true);
}
deleterow - callback function, called when a row is deleted. If multiple rows are deleted, the rowid parameter is an array of row ids.
deleterow: function (rowid, commit) {
// synchronize with the server - send delete command
// call commit with parameter true if the synchronization with the server is successful
//and with parameter false if the synchronization failed.
commit(true);
}
updaterow - callback function, called when a row is updated. If multiple rows are added, the rowid and rowdata parameters are arrays of row ids and rows.
Example:
updaterow: function (rowid, newdata, commit) {
// synchronize with the server - send update command
// call commit with parameter true if the synchronization with the server is successful
// and with parameter false if the synchronization failed.
commit(true);
}
processdata - extend the default data object sent to the server.
var source =
{
datatype: "jsonp",
datafields: [
{ name: 'countryName' },
{ name: 'name' },
{ name: 'population', type: 'float' },
{ name: 'continentCode' }
],
url: "http://api.geonames.org/searchJSON",
processdata: function (data) {
data.featureClass = "P";;
data.style = "full";
data.maxRows = 50;
data.username = "jqwidgets";
}
};
formatdata - Before the data is sent to the server, you can fully override it by using the 'formatdata' function of the source object. The result that the 'formatdata' function returns is actually what will be sent to the server.
var source =
{
datatype: "jsonp",
datafields: [
{ name: 'countryName' },
{ name: 'name' },
{ name: 'population', type: 'float' },
{ name: 'continentCode' }
],
url: "http://ws.geonames.org/searchJSON",
data: {
featureClass: "P",
style: "full",
maxRows: 50
},
formatdata: function (data) {
return "my data";
}
};
contenttype: Use this option, If you want to explicitly pass in a content-type. Default is "application/x-www-form-urlencoded".
The example code below illustrates how to create jqxDataAdapter from a source object.
var dataAdapter = new $.jqx.dataAdapter(source, {
loadComplete: function (data)
{
// data is loaded.
},
loadError: function (xhr, status, error)
{
// data is not loaded.
}
});
If you on the Grid to remote data source using asynchronous requests( that is by default when you specify url in the source object and you didn't set the async field to false), then make sure that you call any method or set a property once the data is loaded. To ensure that you call your code when the Grid is loaded with data, use the Grid's ready callback function or on to the 'bindingcomplete' event before the Grid's initialization and call your code inside the event handler.
Example with 'ready' callback:
var url = "../sampledata/beverages.txt";
// prepare the data
var source =
{
datatype: "json",
datafields: [
{ name: 'name' },
{ name: 'type' },
{ name: 'calories', type: 'int' },
{ name: 'totalfat' },
{ name: 'protein' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").jqxGrid(
{
width: 400,
source: dataAdapter,
ready: function () {
$("#jqxgrid").jqxGrid('hidecolumn', 'name');
},
columnsresize: true,
columns: [
{ text: 'Name', datafield: 'name', width: 250 },
{ text: 'Beverage Type', datafield: 'type', width: 250 },
{ text: 'Calories', datafield: 'calories', width: 180 },
{ text: 'Total Fat', datafield: 'totalfat', width: 120 },
{ text: 'Protein', datafield: 'protein', minwidth: 120 }
]
});
Example with 'bindingcomplete':
var url = "../sampledata/beverages.txt";
// prepare the data
var source =
{
datatype: "json",
datafields: [
{ name: 'name' },
{ name: 'type' },
{ name: 'calories', type: 'int' },
{ name: 'totalfat' },
{ name: 'protein' }
],
id: 'id',
url: url
};
var dataAdapter = new $.jqx.dataAdapter(source);
$("#jqxgrid").on('bindingcomplete', function (event) {
$("#jqxgrid").jqxGrid('hidecolumn', 'name');
});
$("#jqxgrid").jqxGrid(
{
width: 400,
source: dataAdapter,
columnsresize: true,
columns: [
{ text: 'Name', datafield: 'name', width: 250 },
{ text: 'Beverage Type', datafield: 'type', width: 250 },
{ text: 'Calories', datafield: 'calories', width: 180 },
{ text: 'Total Fat', datafield: 'totalfat', width: 120 },
{ text: 'Protein', datafield: 'protein', minwidth: 120 }
]
});
Initialize a Grid with the source property specified.
Bind the Grid to an array
The data member is array. The datatype member is set to "array".
<!DOCTYPE html>
<html lang="en">
<head>
<title id='Description'>Grid populated from Array.</title>
<link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
<script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
<script type="text/javascript">
$(document).ready(function () {
// prepare the data
var data = new Array();
var firstNames =
[
"Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"
];
var lastNames =
[
"Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"
];
var productNames =
[
"Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"
];
var priceValues =
[
"2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"
];
for (var i = 0; i < 50; i++) {
var row = {};
var productindex = Math.floor(Math.random() * productNames.length);
var price = parseFloat(priceValues[productindex]);
var quantity = 1 + Math.round(Math.random() * 10);
row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
row["productname"] = productNames[productindex];
row["price"] = price;
row["quantity"] = quantity;
row["total"] = price * quantity;
data[i] = row;
}
var source =
{
localdata: data,
datatype: "array"
};
var dataAdapter = new $.jqx.dataAdapter(source, {
downloadComplete: function (data, status, xhr) { },
loadComplete: function (data) { },
loadError: function (xhr, status, error) { }
});
$("#jqxgrid").jqxGrid(
{
width: 670,
source: dataAdapter,
columns: [
{ text: 'First Name', datafield: 'firstname', width: 100 },
{ text: 'Last Name', datafield: 'lastname', width: 100 },
{ text: 'Product', datafield: 'productname', width: 180 },
{ text: 'Quantity', datafield: 'quantity', width: 80, cellsalign: 'right' },
{ text: 'Unit Price', datafield: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
{ text: 'Total', datafield: 'total', width: 100, cellsalign: 'right', cellsformat: 'c2' }
]
});
});
</script>
</head>
<body class='default'>
<div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
<div id="jqxgrid"></div>
</div>
</body>
</html>
|
sorttogglestates
|
String
|
2
|
(requires jqxgrid.sort.js)
Sets the sort toggle states.
Possible Values:
'0'-disables toggling
'1'-enables togging. Click on a column toggles the sort direction
'2'-enables remove sorting option
Code example
Set the sorttogglestates property.
$('#jqxGrid').jqxGrid({ sorttogglestates: 1});
Get the sorttogglestates property.
var sorttogglestates = $('#jqxGrid').jqxGrid('sorttogglestates');
|
updatedelay
|
Number
|
0
|
Sets or gets the rendering update delay. This could be used for deferred scrolling scenarios.
Code example
Set the updatedelay property.
$('#jqxGrid').jqxGrid({ updatedelay: 5});
Get the updatedelay property.
var updatedelay = $('#jqxGrid').jqxGrid('updatedelay');
|
virtualmode
|
Boolean
|
false
|
Enables or disables the virtual data mode.
Code example
Set the virtualmode property.
$('#jqxGrid').jqxGrid({ virtualmode: true});
Get the virtualmode property.
var virtualmode = $('#jqxGrid').jqxGrid('virtualmode');
|
verticalscrollbarstep
|
Number
|
5
|
Sets or gets the scrollbar's step when the user clicks the scroll arrows.
Code example
Set the verticalscrollbarstep property.
$("#jqxGrid").jqxGrid({ verticalscrollbarstep: 15});
Get the verticalscrollbarstep property.
var verticalscrollbarstep = $('#jqxGrid').jqxGrid('verticalscrollbarstep');
|
verticalscrollbarlargestep
|
Number
|
400
|
Sets or gets the scrollbar's large step. This property specifies the step with which the vertical scrollbar's
value is changed when the user clicks the area above or below the thumb.
Code example
Set the verticalscrollbarlargestep property.
$("#jqxGrid").jqxGrid({ verticalscrollbarlargestep: 50});
Get the verticalscrollbarlargestep property.
var verticalscrollbarlargestep = $('#jqxGrid').jqxGrid('verticalscrollbarlargestep');
|
|
bindingcomplete
|
Event
|
|
This event is triggered when the binding is completed. Note: Bind to that event before the Grid's initialization, because if you data bind the Grid to a local data source and bind to the "bindingcomplete" event after the initializaation, the data binding will be already completed.
Code example
Bind to the bindingcomplete event by type: jqxGrid.
$("#jqxGrid").on("bindingcomplete", function (event) {// your code here.});
|
columnresized
|
Event
|
|
This event is triggered when a Grid Column is resized.
Code example
Bind to the columnresized event by type: jqxGrid.
$("#jqxGrid").on("columnresized", function (event)
{
// event arguments.
var args = event.args;
// column text.
var columnText = args.columntext;
// column data field.
var dataField = args.datafield;
// old column width.
var oldWidth = args.oldwidth;
// new column width.
var newWidth = args.newwidth;
});
|
columnreordered
|
Event
|
|
This event is triggered when a Grid Column is moved to a new position.
Code example
Bind to the columnreordered event by type: jqxGrid.
$("#jqxGrid").on("columnreordered", function (event)
{
// event arguments.
var args = event.args;
// column text.
var columnText = args.columntext;
// column data field.
var dataField = args.datafield;
// old column index.
var oldIndex = args.oldindex;
// new column index.
var newIndex = args.newindex;
});
|
columnclick
|
Event
|
|
This event is triggered when a column is clicked.
Code example
Bind to the columnclick event by type: jqxGrid.
$("#jqxGrid").on("columnclick", function (event)
{
// event arguments.
var args = event.args;
// column's settings.
var column = args.column;
// column data field.
var dataField = args.dataField;
// original event.
var ev = args.originalEvent;
});
|
cellclick
|
Event
|
|
This event is triggered when a cell is clicked.
Code example
Bind to the cellclick event by type: jqxGrid.
$("#jqxGrid").on("cellclick", function (event)
{
// event arguments.
var args = event.args;
// row's bound index.
var rowBoundIndex = args.rowindex;
// row's visible index.
var rowVisibleIndex = args.visibleindex;
// right click.
var rightclick = args.rightclick;
// original event.
var ev = args.originalEvent;
// column index.
var columnindex = args.columnindex;
// column data field.
var dataField = args.datafield;
// cell value
var value = args.value;
});
|
celldoubleclick
|
Event
|
|
This event is triggered when a cell is double-clicked.
Code example
Bind to the celldoubleclick event by type: jqxGrid.
$("#jqxGrid").on("celldoubleclick", function (event)
{
// event arguments.
var args = event.args;
// row's bound index.
var rowBoundIndex = args.rowindex;
// row's visible index.
var rowVisibleIndex = args.visibleindex;
// right click.
var rightClick = args.rightclick;
// original event.
var ev = args.originalEvent;
// column index.
var columnIndex = args.columnindex;
// column data field.
var dataField = args.datafield;
// cell value
var value = args.value;
});
|
cellselect
|
Event
|
|
This event is triggered when a cell is selected.
Code example
Bind to the cellselect event by type: jqxGrid.
$("#jqxGrid").on('cellselect', function (event)
{
// event arguments.
var args = event.args;
// get the column's text.
var column = $("#jqxGrid").jqxGrid('getcolumn', event.args.datafield).text;
// column data field.
var dataField = event.args.datafield;
// row's bound index.
var rowBoundIndex = event.args.rowindex;
// cell value
var value = args.value;
});
|
cellunselect
|
Event
|
|
This event is triggered when a cell is unselected.
Code example
Bind to the cellunselect event by type: jqxGrid.
$("#jqxGrid").on('cellunselect', function (event)
{
// event arguments.
var args = event.args;
// get the column's text.
var column = $("#jqxGrid").jqxGrid('getcolumn', event.args.datafield).text;
// column data field.
var dataField = event.args.datafield;
// row's bound index.
var rowBoundIndex = event.args.rowindex;
// cell value
var value = args.value;
});
|
cellvaluechanged
|
Event
|
|
This event is triggered when a cell's value is changed.
Code example
Bind to the cellvaluechanged event by type: jqxGrid.
$("#jqxGrid").on('cellvaluechanged', function (event)
{
// event arguments.
var args = event.args;
// column data field.
var datafield = event.args.datafield;
// row's bound index.
var rowBoundIndex = args.rowindex;
// new cell value.
var value = args.newvalue;
// old cell value.
var oldvalue = args.oldvalue;
});
|
cellbeginedit
|
Event
|
|
This event is triggered when a cell's editor is displayed.
Code example
Bind to the cellbeginedit event by type: jqxGrid.
$("#jqxGrid").on('cellbeginedit', function (event)
{
// event arguments.
var args = event.args;
// column data field.
var dataField = event.args.datafield;
// row's bound index.
var rowBoundIndex = event.args.rowindex;
// cell value
var value = args.value;
// row's data.
var rowData = args.row;
});
|
cellendedit
|
Event
|
|
This event is triggered when a cell's edit operation has ended.
Code example
Bind to the cellendedit event by type: jqxGrid.
$("#jqxGrid").on('cellendedit', function (event)
{
// event arguments.
var args = event.args;
// column data field.
var dataField = event.args.datafield;
// row's bound index.
var rowBoundIndex = event.args.rowindex;
// cell value
var value = args.value;
// cell old value.
var oldvalue = args.oldvalue;
// row's data.
var rowData = args.row;
});
|
filter
|
Event
|
|
This event is triggered when the Grid is filtered.
Code example
Bind to the filter event by type: jqxGrid.
$("#jqxGrid").on("filter", function (event)
{
var filterinfo = $("#jqxgrid").jqxGrid('getfilterinformation');
});
|
groupschanged
|
Event
|
|
This event is triggered when a group is added, inserted or removed.
Code example
Bind to the groupschanged event by type: jqxGrid.
$("#jqxGrid").on("groupschanged",
function (event)
{
// event arguments.
var args = event.args;
// type of change. Possible values: Add, Remove, Clear, Insert
var type = args.type;
// group index. The index of the added, removed or inserted group. If the type is "Clear", -1 is passed.
var groupIndex = args.index.
// groups array.
var groups = args.groups;
});
|
groupexpand
|
Event
|
|
This event is triggered when a group is expanded.
Code example
Bind to the groupexpand event by type: jqxGrid.
$("#jqxGrid").on('groupexpand', function (event)
{
// event arguments.
var args = event.args;
// expanded group name.
var group = args.group;
// expanded group level.
var level = args.level;
// sub groups - contains an array of sub-level's groups.
var subGroups = args.subgroups;
// sub rows - contains an array of sub-level's data rows or null when there are only sub groups.
var subRows = args.subrows;
});
|
groupcollapse
|
Event
|
|
This event is triggered when a group is collapsed.
Code example
Bind to the groupcollapse event by type: jqxGrid.
$("#jqxGrid").on('groupcollapse', function (event)
{
// event arguments.
var args = event.args;
// expanded group name.
var group = args.group;
// expanded group level.
var level = args.level;
// sub groups - contains an array of sub-level's groups.
var subGroups = args.subgroups;
// sub rows - contains an array of sub-level's data rows or null when there are only sub groups.
var subRows = args.subrows;
});
|
pagechanged
|
Event
|
|
This event is triggered when the current page is changed.
Code example
Bind to the pagechanged event by type: jqxGrid.
$("#jqxGrid").on("pagechanged", function (event)
{
// event arguments.
var args = event.args;
// page number.
var pagenum = args.pagenum;
// page size.
var pagesize = args.pagesize;
});
|
pagesizechanged
|
Event
|
|
This event is triggered when the page size is changed.
Code example
Bind to the pagesizechanged event by type: jqxGrid.
$("#jqxGrid").on("pagesizechanged", function (event)
{
// event arguments.
var args = event.args;
// page number.
var pagenum = args.pagenum;
// old page size.
var oldpagesize = args.oldpagesize;
// new page size.
var pagesize = args.pagesize;
});
|
rowclick
|
Event
|
|
This event is triggered when a row is clicked.
Code example
Bind to the rowclick event by type: jqxGrid.
$('#jqxGrid').on('rowclick', function (event)
{
var args = event.args;
// row's bound index.
var boundIndex = args.rowindex;
// row's visible index.
var visibleIndex = args.visibleindex;
// right click.
var rightclick = args.rightclick;
// original event.
var ev = args.originalEvent;
});
|
rowdoubleclick
|
Event
|
|
This event is triggered when a row is double clicked.
Code example
Bind to the rowdoubleclick event by type: jqxGrid.
$('#jqxGrid').on('rowdoubleclick', function (event)
{
var args = event.args;
// row's bound index.
var boundIndex = args.rowindex;
// row's visible index.
var visibleIndex = args.visibleindex;
// right click.
var rightclick = args.rightclick;
// original event.
var ev = args.originalEvent;
});
|
rowselect
|
Event
|
|
This event is triggered when a row is selected.
Code example
Bind to the rowselect event by type: jqxGrid.
$('#jqxGrid').on('rowselect', function (event)
{
// event arguments.
var args = event.args;
// row's bound index.
var rowBoundIndex = args.rowindex;
// row's data. The row's data object or null(when all rows are being selected or unselected with a single action). If you have a datafield called "firstName", to access the row's firstName, use var firstName = rowData.firstName;
var rowData = args.row;
});
|
rowunselect
|
Event
|
|
This event is triggered when a row is unselected.
Code example
Bind to the rowunselect event by type: jqxGrid.
$('#jqxGrid').on('rowunselect', function (event)
{
// event arguments.
var args = event.args;
// row's bound index.
var rowBoundIndex = args.rowindex;
// row's data. The row's data object or null(when all rows are being selected or unselected with a single action). If you have a datafield called "firstName", to access the row's firstName, use var firstName = rowData.firstName;
var rowData = args.row;
});
|
rowexpand
|
Event
|
|
This event is triggered when a row with details is expanded.
Code example
Bind to the rowexpand event by type: jqxGrid.
$('#jqxGrid').on('rowexpand', function (event)
{
// event arguments.
var args = event.args;
// row details.
var details = args.details;
// row's bound index.
var rowBoundIndex = args.rowindex;
});
|
rowcollapse
|
Event
|
|
This event is triggered when a row with details is collapsed.
Code example
Bind to the rowcollapse event by type: jqxGrid.
$('#jqxGrid').on('rowcollapse', function (event)
{
// event arguments.
var args = event.args;
// row details.
var details = args.details;
// row's bound index.
var rowBoundIndex = args.rowindex;
});
|
sort
|
Event
|
|
This event is triggered when the Grid is sorted.
Code example
Bind to the sort event by type: jqxGrid.
$("#jqxGrid").on("sort", function (event)
{
// event arguments.
var args = event.args;
// sorting information.
var sortInfo = event.args.sortinformation;
// sort direction.
var sortdirection = sortInfo.sortdirection.ascending ? "ascending" : "descending";
// column data field.
var sortColumnDataField = sortInfo.sortcolumn;
});
|
|
|
|
|
|
|
|
|
|
|
Common
|
|
|
|
|
|
|
|
|
autoresizecolumns
|
Method
|
|
(requires jqxgrid.columnsresize.js)
Auto-resizes all columns.
Optional parameter:
'all' - resize columns to fit to cells and column header. This is the default option.
'cells' - resize columns to fit to the cells text.
'column' - resize columns to fit to the columns text.
Parameter |
Type |
Description |
type(optional) |
String |
"all", "cells" or "column" |
Return Value
None
Code example
Invoke the autoresizecolumns method.
$('#jqxGrid').jqxGrid('autoresizecolumns');
|
autoresizecolumn
|
Method
|
|
(requires jqxgrid.columnsresize.js)
Auto-resizes a column.
First Parameter - the column's datafield.
Second Parameter(optional:
'all' - resize columns to fit to cells and column header. This is the default option.
'cells' - resize columns to fit to the cells text.
'column' - resize columns to fit to the columns text.
Parameter |
Type |
Description |
dataField |
String |
|
type(optional) |
String |
"all", "cells" or "column" |
Return Value
None
Code example
Invoke the autoresizecolumn method.
$('#jqxGrid').jqxGrid('autoresizecolumn', 'firstname');
|
beginupdate
|
Method
|
|
Starts an update operation. This is appropriate when calling multiple methods or set multiple properties at once. Optional boolean parameter: suspendAllActions. When you call beginupdate with parameter equal to true , the jqxGrid stops all rendering processes and when you call "endupdate", it will call the "render" method. Otherwise, it will try to resume its state with minimial performance impact. Use the suspendAllActions when you make multiple changes which require full-rerender such as changing the Grid's source, columns, groups.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the beginupdate method.
.
$('#jqxGrid').jqxGrid('beginupdate');
|
clear
|
Method
|
|
Clears the Grid contents.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the clear method.
$('#jqxGrid').jqxGrid('clear');
|
destroy
|
Method
|
|
Removes the Grid from the document and releases its resources.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the destroy method.
$('#jqxGrid').jqxGrid('destroy');
|
endupdate
|
Method
|
|
Ends the update operation.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the endupdate method.
$('#jqxGrid').jqxGrid('endupdate');
|
ensurerowvisible
|
Method
|
|
Scrolls to a row. The parameter is a bound index.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the ensurerowvisible method.
// @param Number. The row index.
$('#jqxGrid').jqxGrid('ensurerowvisible', 100);
|
focus
|
Method
|
|
Sets the keyboard Focus to the jqxGrid widget.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the focus method.
$('#jqxGrid').jqxGrid('focus');
|
getcolumnindex
|
Method
|
|
(requires jqxgrid.columnsreorder.js)
Gets the index of a column in the columns collection.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
Number
Code example
Invoke the getcolumnindex method.
// @param String. The column datafield member.
var index = $('#jqxGrid').jqxGrid('getcolumnindex', 'name');
|
getcolumn
|
Method
|
|
Gets a column by datafield value.Column's fields:
- datafield - column's datafield. To get the cells labels and values from the data source, the Grid uses the "datafield" and "displayfield" properties. If the "displayfield" is not set, the "displayfield" is equal to the "datafield'.
- text - column's text.
- displayfield - column's displayfield. To get the cells labels and values from the data source, the Grid uses the "datafield" and "displayfield" properties. If the "displayfield" is not set, the "displayfield" is equal to the "datafield'.
- sortable - determines whether the column is sortable.
- filterable - determines whether the column is filterable.
- exportable - determines whether the column will be exported through the "exportdata" method.
- editable - determines whether the column is editable.
- groupable - determines whether the column is groupable.
- resizable - determines whether the column is resizable.
- draggable - determines whether the column is draggable.
- classname - determines the column's header classname.
- cellclassname - determines the column's cells classname.
- width - determines the column's width.
- menu - determines whether the column has an associated popup menu or not.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
Object
Code example
Invoke the getcolumn method.
// @param String. The column datafield member.
var column = $('#jqxGrid').jqxGrid('getcolumn', 'columndatafield');
|
getcolumnproperty
|
Method
|
|
Gets a property of a column. Possible property names: 'text', 'hidden', 'hideable', 'renderer', 'cellsrenderer', 'align', 'cellsalign', 'cellsformat', 'pinned', 'contenttype', 'resizable', 'filterable', 'editable', 'cellclassname', 'classname', 'width', 'minwidth', 'maxwidth'
Parameter |
Type |
Description |
dataField |
String |
|
propertyName |
String |
|
Return Value
Object
Code example
Invoke the getcolumnproperty method.
// @param String. Column data field.
// @param String. Property Name.
var value = $('#jqxGrid').jqxGrid('getcolumnproperty', 'firstname', 'width');
|
getrowid
|
Method
|
|
Gets the id of a row. The returned value is a 'String' or 'Number' depending on the id's type. The parameter is the row's bound index.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
String
Code example
Invoke the getrowid method. The example code below returns the id of the first row.
// @param row index.
var id = $('#jqxGrid').jqxGrid('getrowid', 0);
|
getrowdata
|
Method
|
|
Gets the data of a row. The returned value is a JSON Object. The parameter is the row's bound index. Note: If you pass a bound index of a row which is not visible in the Grid, the method returns null.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
Object - returns the row's data.
Code example
Invoke the getrowdata method.
// @param row index.
var data = $('#jqxGrid').jqxGrid('getrowdata', 0);
|
getrowdatabyid
|
Method
|
|
Gets the data of a row. The returned value is a JSON Object. The parameter is the row's id.
Parameter |
Type |
Description |
rowID |
String |
|
Return Value
Object - returns the row's data.
Code example
Invoke the getrowdatabyid method.
// @param bound index. Bound index is the row's index in the array returned by the "getboundrows" method.
var rowid = $('#jqxGrid').jqxGrid('getrowid', 5);
// @param row id
var data = $('#jqxGrid').jqxGrid('getrowdatabyid', rowid);
|
getrowboundindexbyid
|
Method
|
|
Gets the index of a row in the array returned by the getboundrows method.
Parameter |
Type |
Description |
rowID |
String |
|
Return Value
Number - returns the row's bound index.
Code example
Invoke the getrowboundindexbyid method.
// @param row id
var data = $('#jqxGrid').jqxGrid('getrowboundindexbyid', rowid);
|
getrowboundindex
|
Method
|
|
Gets the index of a row in the array returned by the getboundrows method.
Parameter |
Type |
Description |
rowDisplayIndex |
Number |
|
Return Value
Number - returns the row's bound index.
Code example
Invoke the getrowboundindex method.
// @param index - the row's display index.
var data = $('#jqxGrid').jqxGrid('getrowboundindex', 0);
|
getrows
|
Method
|
|
Gets all rows. Returns an array of all rows loaded in the Grid. If the Grid is filtered, the returned value is an array of the filtered records.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array
Code example
Invoke the getrows method.
var rows = $('#jqxGrid').jqxGrid('getrows');
|
getboundrows
|
Method
|
|
Gets all rows loaded from the data source. The method returns an Array of all rows. The Grid's sorting, filtering, grouping and paging will not affect the result of this method. It will
always return the rows collection loaded from the data source.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array
Code example
Invoke the getboundrows method.
// gets all rows loaded from the data source.
var rows = $('#jqxGrid').jqxGrid('getboundrows');
// gets the first row loaded from the data source.
var rowData = rows[0];
// gets the ID of the first row.
var rowID = rowData.uid;
|
getdisplayrows
|
Method
|
|
Gets all rows that are currently displayed in the Grid. The method returns an Array of the displayed rows. The Grid's sorting, filtering, grouping and paging will affect the result of this method.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array
Code example
Invoke the getdisplayrows method.
// gets all rows loaded from the data source.
var rows = $('#jqxGrid').jqxGrid('getdisplayrows');
// gets the first displayed row.
var rowData = rows[0];
// gets the ID of the first displayed row.
var rowID = rowData.uid;
// gets the bound index of the first displayed row. The bound index is the row's index in the array returned by the "getboundrows" method.
var boundIndex = rowdData.boundindex;
|
getdatainformation
|
Method
|
|
Gets bound data information.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object
Code example
Invoke the getdatainformation method.
var datainformation = $('#jqxGrid').jqxGrid('getdatainformation');
var rowscount = datainformation.rowscount;
var sortinformation = datainformation.sortinformation;
var sortcolumn = sortinformation.sortcolumn;
var sortdirection = sortinformation.sortdirection;
var paginginformation = datainformation.paginginformation;
var pagenum = paginginformation.pagenum;
var pagesize = paginginformation.pagesize;
var pagescount = paginginformation.pagescount;
|
getsortinformation
|
Method
|
|
Gets the sort information.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object - object.sortcolumn - sort column's datafield or null. object.sortdirection - Object with two fields: { 'ascending': true, 'descending': false }
Code example
Invoke the getsortinformation method.
var sortinformation = $('#jqxGrid').jqxGrid('getsortinformation');
// The sortcolumn represents the sort column's datafield. If there's no sort column, the sortcolumn is null.
var sortcolumn = sortinformation.sortcolumn;
// The sortdirection is an object with two fields: 'ascending' and 'descending'. Ex: { 'ascending': true, 'descending': false }
var sortdirection = sortinformation.sortdirection;
|
getpaginginformation
|
Method
|
|
(requires jqxgrid.pager.js)
Gets the paging information.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object object.pagenum - page number, object.pagesize - page size, object.pagescount - total pages count.
Code example
Invoke the getpaginginformation method.
var paginginformation = $('#jqxGrid').jqxGrid('getpaginginformation');
// The page's number.
var pagenum = paginginformation.pagenum;
// The page's size.
var pagesize = paginginformation.pagesize;
// The number of all pages.
var pagescount = paginginformation.pagescount;
|
hidecolumn
|
Method
|
|
Hides a column.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the hidecolumn method.
// @param String. The column datafield member.
$('#jqxGrid').jqxGrid('hidecolumn', 'columndatafield');
|
hideloadelement
|
Method
|
|
Hides the data loading image.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the hideloadelement method.
$('#jqxGrid').jqxGrid('hideloadelement');
|
hiderowdetails
|
Method
|
|
Hides the details of a row.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the hiderowdetails method.
// @param Number. The row index.
$('#jqxGrid').jqxGrid('hiderowdetails', 1);
|
iscolumnvisible
|
Method
|
|
Gets whether a column is visible. Returns a boolean value.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
Boolean
Code example
Invoke the iscolumnvisible method.
// @param String. The column datafield member.
var visible = $('#jqxGrid').jqxGrid('iscolumnvisible', 'columndatafield');
|
iscolumnpinned
|
Method
|
|
Gets whether a column is pinned. Returns a boolean value.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
Boolean
Code example
Invoke the iscolumnpinned method.
// @param String. The column datafield member.
var pinned = $('#jqxGrid').jqxGrid('iscolumnpinned', 'columndatafield');
|
localizestrings
|
Method
|
|
Localizes the grid strings. This method allows you to change the valus of all Grid strings and also to change the cells formatting settings.
Parameter |
Type |
Description |
localizationObject |
Object |
|
Return Value
None
Code example
Invoke the localizestrings method.
var localizationobj = {};
localizationobj.pagergotopagestring = "Page:";
localizationobj.pagershowrowsstring = "angezeigten datensätze";
localizationobj.pagerrangestring = " aus ";
localizationobj.pagernextbuttonstring = "kommend";
localizationobj.pagerpreviousbuttonstring = "vorherig";
localizationobj.sortascendingstring = "aufsteigend sortieren";
localizationobj.sortdescendingstring = "absteigend sortieren";
localizationobj.sortremovestring = "entfernen sortierung";
localizationobj.firstDay = 1;
localizationobj.percentsymbol = "%";
localizationobj.currencysymbol = "€";
localizationobj.currencysymbolposition = "before";
localizationobj.decimalseparator = ".";
localizationobj.thousandsseparator = ",";
var days = {
// full day names
names: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"],
// abbreviated day names
namesAbbr: ["Sonn", "Mon", "Dien", "Mitt", "Donn", "Fre", "Sams"],
// shortest day names
namesShort: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"]
};
localizationobj.days = days;
var months = {
// full month names (13 months for lunar calendards -- 13th month should be "" if not lunar)
names: ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember", ""],
// abbreviated month names
namesAbbr: ["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dez", ""]
};
localizationobj.months = months;
// apply localization.
$("#jqxGrid").jqxGrid('localizestrings', localizationobj);
|
pincolumn
|
Method
|
|
Pins the column.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the pincolumn method.
// @param String. The column datafield member.
$('#jqxGrid').jqxGrid('pincolumn', 'columndatafield');
|
refreshdata
|
Method
|
|
Refreshes the data.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the refreshdata method.
$('#jqxGrid').jqxGrid('refreshdata');
|
refresh
|
Method
|
|
Repaints the Grid View.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the refresh method.
$('#jqxGrid').jqxGrid('refresh');
|
render
|
Method
|
|
Renders the Grid contents. This method completely refreshes the Grid cells, columns, layout and repaints the view.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the render method.
$('#jqxGrid').jqxGrid('render');
|
scrolloffset
|
Method
|
|
Scrolls the grid contents.
Parameter |
Type |
Description |
top |
Number |
|
left |
Number |
|
Return Value
None
Code example
Invoke the scrolloffset method.
//@param Number. Top position.
//@param Number. Left position.
$('#jqxGrid').jqxGrid('scrolloffset', 10, 20);
|
scrollposition
|
Method
|
|
Returns the scrollbars position.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object object.left and object.top - horizontal and vertical scroll position.
Code example
Invoke the scrollposition method.
var position = $('#jqxGrid').jqxGrid('scrollposition');
var left = position.left;
var top = position.top;
|
showloadelement
|
Method
|
|
Shows the data loading image.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the showloadelement method.
$('#jqxGrid').jqxGrid('showloadelement');
|
showrowdetails
|
Method
|
|
Shows the details of a row.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the showrowdetails method.
// @param Number. The row index.
$('#jqxGrid').jqxGrid('showrowdetails', 1);
|
setcolumnindex
|
Method
|
|
(requires jqxgrid.columnsreorder.js)
Sets the index of a column in the columns collection.
Parameter |
Type |
Description |
dataField |
String |
|
index |
Number |
|
Return Value
None
Code example
Invoke the setcolumnindex method.
// @param String. The column datafield member.
// @param Number. The column's number.
$('#jqxGrid').jqxGrid('setcolumnindex', 'name', 3);
|
setcolumnproperty
|
Method
|
|
Sets a property of a column.Possible property names: 'text', 'hidden', 'hideable', 'renderer', 'cellsrenderer', 'align', 'cellsalign', 'cellsformat', 'pinned', 'contenttype', 'resizable', 'filterable', 'editable', 'cellclassname', 'classname', 'width', 'minwidth', 'maxwidth'
Parameter |
Type |
Description |
dataField |
String |
|
propertyName |
String |
|
propertyValue |
Object |
|
Return Value
None
Code example
Invoke the setcolumnproperty method.
// @param String. Column data field.
// @param String. Property Name.
// @param Object. Property Value.
$('#jqxGrid').jqxGrid('setcolumnproperty', 'firstname', 'width', 100);
|
showcolumn
|
Method
|
|
Shows a column.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the showcolumn method.
// @param String. The column datafield member.
$('#jqxGrid').jqxGrid('showcolumn', 'columndatafield');
|
unpincolumn
|
Method
|
|
Unpins the column.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the unpincolumn method.
// @param String. The column datafield member.
$('#jqxGrid').jqxGrid('unpincolumn', 'columndatafield');
|
updatebounddata
|
Method
|
|
Updates the bound data and refreshes the grid. You can pass 'filter' or 'sort' as parameter, if the update reason is change in 'filtering' or 'sorting'.
To update only the data without the columns, use the 'data' parameter. To make a quick update of the cells, pass "cells" as parameter. Passing "cells" will refresh only the cells values when the new rows count is equal to the previous rows count.
To make a full update, do not pass any parameter.
Parameter |
Type |
Description |
type(optional) |
String |
|
Return Value
None
Code example
Invoke the updatebounddata method.
$('#jqxGrid').jqxGrid('updatebounddata');
|
updating
|
Method
|
|
Gets the updating operation state. Returns a boolean value.
Parameter |
Type |
Description |
None |
|
|
Return Value
Boolean
Code example
Invoke the updating method.
var isupdating = $('#jqxGrid').jqxGrid('updating');
|
|
|
|
|
|
|
|
|
|
Sorting(requires jqxgrid.sort.js)
|
|
|
|
|
|
|
|
|
|
|
|
getsortcolumn
|
Method
|
|
(requires jqxgrid.sort.js)
Gets the sort column. Returns the column's datafield or null, if sorting is not applied.
Parameter |
Type |
Description |
None |
|
|
Return Value
String
Code example
Invoke the getsortcolumn method.
var sortcolumn = $('#jqxGrid').jqxGrid('getsortcolumn');
|
removesort
|
Method
|
|
Removes the sorting.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the removesort method.
$('#jqxGrid').jqxGrid('removesort');
|
sortby
|
Method
|
|
Sorts the Grid data.
Parameter |
Type |
Description |
dataField |
String |
|
sortOrder |
String |
"asc", "desc" or null |
Return Value
None
Code example
Invoke the sortby method.
$('#jqxGrid').jqxGrid('sortby', 'columndatafield', 'asc');
|
|
|
|
|
|
|
|
|
|
Grouping(requires jqxgrid.grouping.js)
|
|
|
|
|
|
|
|
|
|
|
|
addgroup
|
Method
|
|
Groups by a column.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the addgroup method.
// @param String. The expected parameter is the column's datafield.
$('#jqxGrid').jqxGrid('addgroup', 'columndatafield');
|
cleargroups
|
Method
|
|
Clears all groups.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the cleargroups method.
$('#jqxGrid').jqxGrid('cleargroups');
|
collapsegroup
|
Method
|
|
Collapses a group.
Parameter |
Type |
Description |
group |
Number/String |
Number for root groups or String like "1.1" for sub groups |
Return Value
None
Code example
Invoke the collapsegroup method.
// @param Number. The group index.
$('#jqxGrid').jqxGrid('collapsegroup', 1);
|
collapseallgroups
|
Method
|
|
Collapses all groups.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the collapseallgroups method.
$('#jqxGrid').jqxGrid('collapseallgroups');
|
expandallgroups
|
Method
|
|
Expands all groups.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the expandallgroups method.
$('#jqxGrid').jqxGrid('expandallgroups');
|
expandgroup
|
Method
|
|
Expands a group.
Parameter |
Type |
Description |
group |
Number/String |
Number for root groups or String like "1.1" for sub groups |
Return Value
None
Code example
Invoke the expandgroup method.
// @param Number. The group index.
$('#jqxGrid').jqxGrid('expandgroup', 1);
|
getrootgroupscount
|
Method
|
|
Gets the number of root groups.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array
Code example
Invoke the getrootgroupscount method.
var groups = $('#jqxGrid').jqxGrid('getrootgroupscount');
|
getgroup
|
Method
|
|
Gets a group. The method returns an Object with details about the Group. The object has the following fields:
- group - group's name.
- level - group's level in the group's hierarchy.
- expanded - group's expand state.
- subgroups - an array of sub groups or null.
- subrows - an array of rows or null.
Parameter |
Type |
Description |
groupIndex |
Number |
|
Return Value
Number
Code example
Invoke the getgroup method.
// @param Number. The group index.
var group = $('#jqxGrid').jqxGrid('getgroup', 0);
|
insertgroup
|
Method
|
|
Groups by a column.
Parameter |
Type |
Description |
groupIndex |
Number |
|
dataField |
String |
|
Return Value
None
Code example
Invoke the insertgroup method.
// @param Number
// @param String. The expected parameter is the column's datafield.
$('#jqxGrid').jqxGrid('insertgroup', 1, 'columndatafield');
|
iscolumngroupable
|
Method
|
|
Gets whether the user can group by a column. Returns a boolean value.
Parameter |
Type |
Description |
None |
|
|
Return Value
Boolean
Code example
Invoke the iscolumngroupable method.
// @param String. The column datafield member.
var groupable = $('#jqxGrid').jqxGrid('iscolumngroupable', 'columndatafield');
|
removegroupat
|
Method
|
|
Removes a group at specific index.
Parameter |
Type |
Description |
groupIndex |
Number |
|
Return Value
None
Code example
Invoke the removegroupat method.
//@param Number
$('#jqxGrid').jqxGrid('removegroupat', 1);
|
removegroup
|
Method
|
|
Removes a group.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the removegroup method.
//@param String. The expected parameter is the column's datafield.
$('#jqxGrid').jqxGrid('removegroup', 'firstname');
|
|
|
|
|
|
|
|
|
|
Filtering(requires jqxgrid.filter.js)
|
|
|
|
|
|
|
|
|
|
|
|
addfilter
|
Method
|
|
Adds a filter to the Grid.
Parameter |
Type |
Description |
dataField |
String |
|
filterGroup |
Object |
|
refreshGrid |
Boolean |
|
Return Value
None
Code example
Invoke the addfilter method.
var filtergroup = new $.jqx.filter();
var filtervalue = 10; // Each cell value is compared with the filter's value.
// filtertype - numericfilter, stringfilter, datefilter or booelanfilter.
// condition
// possible conditions for string filter: 'EMPTY', 'NOT_EMPTY', 'CONTAINS', 'CONTAINS_CASE_SENSITIVE',
// 'DOES_NOT_CONTAIN', 'DOES_NOT_CONTAIN_CASE_SENSITIVE', 'STARTS_WITH', 'STARTS_WITH_CASE_SENSITIVE',
// 'ENDS_WITH', 'ENDS_WITH_CASE_SENSITIVE', 'EQUAL', 'EQUAL_CASE_SENSITIVE', 'NULL', 'NOT_NULL'
// possible conditions for numeric filter: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'
// possible conditions for date filter: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'
var filter = filtergroup.createfilter(filtertype, filtervalue, condition);
var filter2 = filtergroup.createfilter(filtertype, filtervalue2, condition2);
// To create a custom filter, you need to call the createfilter function and pass a custom callback function as a fourth parameter.
// If the callback's name is 'customfilter', the Grid will pass 3 params to this function - filter's value, current cell value to evaluate and the condition.
// operator - 0 for "and" and 1 for "or"
filtergroup.addfilter(operator, filter);
filtergroup.addfilter(operator, filter2);
// datafield is the bound field.
// adds a filter to the grid.
$('#grid').jqxGrid('addfilter', datafield, filtergroup);
// to add and apply the filter, use this:
$('#jqxGrid').jqxGrid('addfilter', datafield, filtergroup, true);
|
applyfilters
|
Method
|
|
Applies all filters to the Grid.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the applyfilters method.
$('#jqxGrid').jqxGrid('applyfilters');
|
clearfilters
|
Method
|
|
Clears all filters from the Grid. You can call the method with optional boolean parameter. If the parameter is "true" or you call the method without parameter, the Grid will
clear the filters and refresh the Grid(default behavior). If the parameter is "false", the method will clear the filters without refreshing the Grid.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the clearfilters method.
$('#jqxGrid').jqxGrid('clearfilters');
|
getfilterinformation
|
Method
|
|
Gets the information about the Grid filters. The method returns an array of the applied filters. The returned information includes the filter objects and filter columns.
Each filter in the Array has the following fields:
- filter - a filter object which may contain one or more filters.
Properties and Methods of the filter object.
- getfilters - returns an array of all filters in the filter object. Each filter in the Array has:
- value - filter's value.
- id - filter's id.
- condition - filter's operator. For String filter the value could be: 'EMPTY', 'NOT_EMPTY', 'CONTAINS', 'CONTAINS_CASE_SENSITIVE',
'DOES_NOT_CONTAIN', 'DOES_NOT_CONTAIN_CASE_SENSITIVE', 'STARTS_WITH', 'STARTS_WITH_CASE_SENSITIVE',
'ENDS_WITH', 'ENDS_WITH_CASE_SENSITIVE', 'EQUAL', 'EQUAL_CASE_SENSITIVE', 'NULL', 'NOT_NULL. For Date and Number filter the value could be: 'EQUAL', 'NOT_EQUAL', 'LESS_THAN', 'LESS_THAN_OR_EQUAL', 'GREATER_THAN', 'GREATER_THAN_OR_EQUAL', 'NULL', 'NOT_NULL'. For Boolean filter, the value could be:
'EQUAL', 'NOT_EQUAL'
- type - filter's type - 'stringfilter', 'numericfilter', 'booleanfilter' or 'datefilter'.
- operator - 'and' or 'or'. Determines the connection between the filters in the group.
- datafield - the column's datafield.
- displayfield - the column's display field.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the getfilterinformation method.
var filtersinfo = $('#jqxGrid').jqxGrid('getfilterinformation');
|
removefilter
|
Method
|
|
Removes a filter from the Grid.
Parameter |
Type |
Description |
dataField |
String |
|
refreshGrid |
Boolean |
|
Return Value
None
Code example
Invoke the removefilter method.
// datafield is the bound field.
$('#jqxGrid').jqxGrid('removefilter', datafield);
// to remove the filter and refresh the Grid, use this:
$('#jqxGrid').jqxGrid('removefilter', datafield, true);
|
refreshfilterrow
|
Method
|
|
Refreshes the filter row and updates the filter widgets. The filter row's widgets are synchronized with the applied filters.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the refreshfilterrow method.
$('#jqxGrid').jqxGrid('refreshfilterrow');
|
|
|
|
|
|
|
|
|
|
Paging(requires jqxgrid.pager.js)
|
|
|
|
|
|
|
|
|
|
|
|
gotopage
|
Method
|
|
Navigates to a page when the Grid paging is enabled i.e when the pageable property value is true.
Parameter |
Type |
Description |
pageNumber |
Number |
|
Return Value
None
Code example
Invoke the gotopage method.
//@param Number
$('#jqxGrid').jqxGrid('gotopage', 1);
|
gotoprevpage
|
Method
|
|
Navigates to a previous page when the Grid paging is enabled i.e when the pageable property value is true.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the gotoprevpage method.
$('#jqxGrid').jqxGrid('gotoprevpage');
|
gotonextpage
|
Method
|
|
Navigates to a next page when the Grid paging is enabled i.e when the pageable property value is true.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the gotonextpage method.
$('#jqxGrid').jqxGrid('gotonextpage');
|
|
|
|
|
|
|
Editing(requires jqxgrid.edit.js)
|
|
|
|
|
|
|
|
|
|
|
|
addrow
|
Method
|
|
Adds a new row or multiple rows.
Parameter |
Type |
Description |
rowIds |
String/Number/Array |
rowID or rowIds. You can use getrowid method for getting the ID of a row. |
data |
Object/Array |
|
rowPosition |
String |
"first" or "last" |
Return Value
None
Code examples
Invoke the addrow method. Add a new row.
// @param row id. Pass null, if you want the new id to be auto-generated or pass a row id.
// @param row data. The expected value is a JSON Object.
var value = $('#jqxGrid').jqxGrid('addrow', rowid, newdata);
Invoke the addrow method. Add a new empty row.
// @param row id. Pass null, if you want the new id to be auto-generated or pass a row id.
// @param row data. The expected value is a JSON Object.
var value = $('#jqxGrid').jqxGrid('addrow', rowid, {});
Invoke the addrow method. Add several rows. In order to add several rows, you need to pass an Array of row ids and an array of rows as parameters. If you pass null as first parameter, the Grid will try to auto generate the row ids.
var rows = new Array();
for (var i = 0; i < 10; i++) {
var datarow = generaterow();
rows.push(datarow);
}
$("#jqxgrid").jqxGrid('addrow', null, rows);
When you call the addrow method, the Grid will also call the source object's addrow callback function(if defined). You can use that callback function for server synchronization.
var source =
{
url: url,
datatype: "json",
datafields:
[
{ name: 'firstname', type: 'string' },
{ name: 'lastname', type: 'string' },
{ name: 'productname', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'price', type: 'number' },
{ name: 'total', type: 'number' }
],
addrow: function (rowid, rowdata, position, commit) {
// synchronize with the server - send insert command
// call commit with parameter true if the synchronization with the server was successful.
// and with parameter false if the synchronization has failed.
// you can pass additional argument to the commit callback which represents the new ID if it is generated from a Database. Example: commit(true, idInDB) where "idInDB" is the row's ID in the Database.
commit(true);
}
};
The last parameter of the addrow method is optional. You can use values like: "first" and "last"(default value). If you pass "first", the new row will be added as a first row.
|
begincelledit
|
Method
|
|
Shows the cell's editor.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
Return Value
None
Code example
Invoke the begincelledit method.
// @param row index
// @param column datafield.
var editable = $("#jqxGrid").jqxGrid('begincelledit', 0, "firstname");
|
beginrowedit
|
Method
|
|
Shows the cell editors for an entire row.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the beginrowedit method.
// @param row index
$("#jqxGrid").jqxGrid('beginrowedit', 0);
|
closemenu
|
Method
|
|
Closes a column's menu.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the closemenu method.
$("#jqxGrid").jqxGrid('closemenu');
|
deleterow
|
Method
|
|
Deletes a row or multiple rows. Returns a boolean value.
Parameter |
Type |
Description |
rowIds |
String/Number/Array |
rowID or rowIds. You can use getrowid method for getting the ID of a row. |
Return Value
None
Code examples
Invoke the deleterow method.
// @param row id. Use the 'getrowid' method to get the id of a row.
$('#jqxGrid').jqxGrid('deleterow', rowid);
Invoke the deleterow method with an Array of row ids. If you pass an array of row ids, the Grid will delete multiple rows.
// get the rows loaded from the data source. Note that "getboundrows" method returns an array of rows loaded from the data source. The Grid's sorting, filtering, grouping and paging will not affect the result of the "getboundrows" method. If you want to get an array of the displayed rows, use the "getdisplayrows" method instead.
var rows = $("#jqxgrid").jqxGrid('getboundrows');
// populate an array with the first and second row ids. "uid" is the row's id.
var rowIDs = new Array();
rowIDs.push(rows[0].uid);
rowIDs.push(rows[1].uid);
// delete the first and second rows.
$("#jqxgrid").jqxGrid('deleterow', rowIDs);
When you call the deleterow method, the Grid will also call the source object's deleterow callback function(if defined). You can use that callback function for server synchronization.
var source =
{
url: url,
datatype: "json",
datafields:
[
{ name: 'firstname', type: 'string' },
{ name: 'lastname', type: 'string' },
{ name: 'productname', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'price', type: 'number' },
{ name: 'total', type: 'number' }
],
deleterow: function (rowid, commit) {
// synchronize with the server - send delete command
// call commit with parameter true if the synchronization with the server was successful
// and with parameter false if the synchronization has failed.
commit(true);
}
};
|
endcelledit
|
Method
|
|
Hides the edit cell's editor and saves or cancels the changes.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
confirmChanges |
Boolean |
|
Return Value
None
Code example
Invoke the endcelledit method.
// @param row index
// @param column datafield.
// @param Boolean. - "true" cancels the changes, "false" confirms the changes.
var editable = $("#jqxGrid").jqxGrid('endcelledit', 0, "firstname", false);
|
endrowedit
|
Method
|
|
Hides the edited row's editors and saves or cancels the changes.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
confirmChanges |
Boolean |
|
Return Value
None
Code example
Invoke the endrowedit method.
// @param row index
// @param Boolean. - "true" cancels the changes, "false" confirms the changes.
$("#jqxGrid").jqxGrid('endrowedit', 0, false);
|
getcell
|
Method
|
|
Gets a cell. Returns an object with the following fields:
- value - cell's value.
- row - cell's row number.
- column - column's datafield.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
datafield |
String |
|
Return Value
Object
Code example
Invoke the getcell method.
// @param Number. The row index.
// @param String. The column datafield.
var cell = $('#jqxGrid').jqxGrid('getcell', 0, datafield);
|
getcellatposition
|
Method
|
|
Gets a cell at specific position. Returns an object with the following fields:
- value - cell's value.
- row - cell's row number.
- column - column's datafield.
Parameter |
Type |
Description |
left |
Number |
|
top |
Number |
|
Return Value
Object
Code example
Invoke the getcellatposition method.
// @param Number. The left position.
// @param Number. The top position.
var cell = $('#jqxGrid').jqxGrid('getcellatposition', left, top);
|
getcelltext
|
Method
|
|
Gets the text of a cell.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
Return Value
String
Code example
Invoke the getcelltext method.
// @param row index.
// @param column datafield.
var text = $('#jqxGrid').jqxGrid('getcelltext', 0, "columndatafield");
|
getcelltextbyid
|
Method
|
|
Gets the text of a cell.
Parameter |
Type |
Description |
rowID |
String |
|
dataField |
String |
|
Return Value
String
Code example
Invoke the getcelltextbyid method.
// @param row id.
// @param column datafield.
var text = $('#jqxGrid').jqxGrid('getcelltextbyid', id1, "columndatafield");
|
getcellvaluebyid
|
Method
|
|
Gets the value of a cell.
Parameter |
Type |
Description |
rowID |
String |
|
dataField |
String |
|
Return Value
Object
Code example
Invoke the getcellvaluebyid method.
// @param row id.
// @param column datafield.
var value = $('#jqxGrid').jqxGrid('getcellvaluebyid', id1, "columndatafield");
|
getcellvalue
|
Method
|
|
Gets the value of a cell.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
Return Value
Object
Code example
Invoke the getcellvalue method.
// @param row index.
// @param column datafield.
var value = $('#jqxGrid').jqxGrid('getcellvalue', 0, "columndatafield");
|
isBindingCompleted
|
Method
|
|
Returns whether the binding is completed and if the result is true, this means that you can invoke methods and set properties. Otherwise, if the binding is not completed and you try to set a property or invoke a method, the widget will throw an exception.
Parameter |
Type |
Description |
None |
|
|
Return Value
Boolean
Code example
Invoke the isBindingCompleted method.
var isCompleted = $("#grid").jqxGrid('isBindingCompleted');
|
openmenu
|
Method
|
|
Displays a column's menu.
Parameter |
Type |
Description |
dataField |
String |
|
Return Value
None
Code example
Invoke the openmenu method.
// @param column datafield.
$("#jqxGrid").jqxGrid('openmenu', "firstname");
|
setcellvalue
|
Method
|
|
Sets a new value to a cell.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
value |
Object |
|
Return Value
None
Code example
Invoke the setcellvalue method.
// @param row index.
// @param column datafield.
// @param cell value
$("#jqxGrid").jqxGrid('setcellvalue', 0, "firstname", "New Value");
|
setcellvaluebyid
|
Method
|
|
Sets a new value to a cell.
Parameter |
Type |
Description |
rowID |
String |
|
dataField |
String |
|
value |
Object |
|
Return Value
None
Code example
Invoke the setcellvaluebyid method.
// @param row id.
// @param column datafield.
// @param cell value
$("#jqxGrid").jqxGrid('setcellvaluebyid', id1, "firstname", "New Value");
|
showvalidationpopup
|
Method
|
|
Displays a validation popup below a Grid cell.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
validationMessage |
String |
|
Return Value
None
Code example
Invoke the showvalidationpopup method.
// @param row index
// @param column datafield.
// @param String(optional)
$("#jqxGrid").jqxGrid('showvalidationpopup', 0, "firstname", "Invalid Value");
|
updaterow
|
Method
|
|
Updates a row or multiple rows.
Parameter |
Type |
Description |
rowIds |
String/Number/Array |
rowID or rowIds. You can use getrowid method for getting the ID of a row. |
data |
Object/Array |
|
Return Value
None
Code examples
Invoke the updaterow method.
// @param row id. Use the 'getrowid' method to get the id of a row.
// @param row data. The expected value is a JSON object.
$('#jqxGrid').jqxGrid('updaterow', rowid, newdata);
Invoke the updaterow method to update multiple rows at once.
var rows = $("#jqxgrid").jqxGrid('getboundrows');
// prepare an array with new rows.
var newRows = new Array();
newRows.push(generaterow());
newRows.push(generaterow());
// prepare an array with row ids to update.
var rowIDs = new Array();
rowIDs.push(rows[0].uid);
rowIDs.push(rows[1].uid);
$("#jqxgrid").jqxGrid('updaterow', rowIDs, newRows);
When you call the updaterow method, the Grid will also call the source object's updaterow callback function(if defined). You can use that callback function for server synchronization.
var source =
{
url: url,
datatype: "json",
datafields:
[
{ name: 'firstname', type: 'string' },
{ name: 'lastname', type: 'string' },
{ name: 'productname', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'price', type: 'number' },
{ name: 'total', type: 'number' }
],
updaterow: function (rowid, rowdata, commit) {
// synchronize with the server - send update command
// call commit with parameter true if the synchronization with the server was successful
// and with parameter false if the synchronization has failed.
commit(true);
}
};
|
|
|
|
|
|
|
Selection(requires jqxgrid.selection.js)
|
|
|
|
|
|
|
|
|
clearselection
|
Method
|
|
Clears the selection.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the clearselection method.
$('#jqxGrid').jqxGrid('clearselection');
|
getselectedrowindex
|
Method
|
|
The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended'
Gets the bound index of the selected row. Returns -1, if there's no selection.
Parameter |
Type |
Description |
None |
|
|
Return Value
Number
Code example
Invoke the getselectedrowindex method.
var rowindex = $('#jqxGrid').jqxGrid('getselectedrowindex');
|
getselectedrowindexes
|
Method
|
|
The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended'
Gets the indexes of the selected rows. Returns an array of the selected rows.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array Returns the indexes of the selected rows.
Code example
Invoke the getselectedrowindexes method.
var rowindexes = $('#jqxGrid').jqxGrid('getselectedrowindexes');
|
getselectedcell
|
Method
|
|
The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended'
Gets the selected cell. The returned value is an Object with two fields: 'rowindex' - the row's bound index and 'datafield' - the column's datafield.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object
Code example
Invoke the getselectedcell method.
var cell = $('#jqxGrid').jqxGrid('getselectedcell');
|
getselectedcells
|
Method
|
|
The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended'
Gets all selected cells. Returns an array of all selected cells. Each cell in the array is an Object with two fields: 'rowindex' - the row's bound index and 'datafield' - the column's datafield.
Parameter |
Type |
Description |
None |
|
|
Return Value
Array
Code example
Invoke the getselectedcells method.
var cells = $('#jqxGrid').jqxGrid('getselectedcells');
|
selectcell
|
Method
|
|
The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended'
Selects a cell.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
dataField |
String |
|
Return Value
None
Code example
Invoke the selectcell method.
// @param Number. The row's bound index.
// @param String. The column datafield.
$('#jqxGrid').jqxGrid('selectcell', 10, 'firstname');
|
selectallrows
|
Method
|
|
The selection mode should be set to: 'multiplerows' or 'multiplerowsextended'
Selects all Grid rows.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the selectallrows method.
$('#jqxGrid').jqxGrid('selectallrows');
|
selectrow
|
Method
|
|
The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended'
Selects a row.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the selectrow method.
// @param Number. The row's bound index.
$('#jqxGrid').jqxGrid('selectrow', 10);
Code example - Select a Row using its Display Index
Invoke the selectrow method.
// select the second row displayed in the Grid.
var index = $('#jqxGrid').jqxGrid('getrowboundindex', 1);
$('#jqxGrid').jqxGrid('selectrow', index);
|
unselectrow
|
Method
|
|
The expected selection mode is 'singlerow', 'multiplerows' or 'multiplerowsextended'
Unselects a row.
Parameter |
Type |
Description |
rowBoundIndex |
Number |
|
Return Value
None
Code example
Invoke the unselectrow method.
// @param Number. The row's bound index.
$('#jqxGrid').jqxGrid('unselectrow', 10);
Code example - Unselect a Row using its Display Index
Invoke the unselectrow method.
// unselect the second row displayed in the Grid.
var index = $('#jqxGrid').jqxGrid('getrowboundindex', 1);
$('#jqxGrid').jqxGrid('unselectrow', index);
|
unselectcell
|
Method
|
|
The expected selection mode is 'singlecell', 'multiplecells' or 'multiplecellsextended'
Unselects a cell.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the unselectcell method.
// @param Number. The row's bound index.
// @param String. The column datafield.
$('#jqxGrid').jqxGrid('unselectcell', 10, 'firstname');
|
|
|
|
|
|
|
Aggregates(requires jqxgrid.aggregates.js)
|
|
|
|
|
|
|
|
|
getcolumnaggregateddata
|
Method
|
|
Gets the aggregated data of a Grid column. Returns a JSON object. Each field name is the aggregate's type('min', 'max', 'sum', etc.).
Parameter |
Type |
Description |
dataField |
String |
column's data field |
aggregates |
Array |
Array of aggregates 'min', 'max', 'sum', etc. |
Return Value
None
Code example
Invoke the getcolumnaggregateddata method.
var summaryData = $("#jqxGrid").jqxGrid('getcolumnaggregateddata', 'quantity', ['min', 'max']);
|
refreshaggregates
|
Method
|
|
Refreshes the Aggregates in the Grid's status bar.
Code example
Invoke the refreshaggregates method.
$('#jqxGrid').jqxGrid('refreshaggregates');
|
renderaggregates
|
Method
|
|
Renders the aggregates in the Grid's status bar.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the renderaggregates method.
$('#jqxGrid').jqxGrid('renderaggregates');
|
Export(requires jqxdata.export.js and jqxgrid.export.js)
|
|
|
|
|
|
|
|
|
exportdata
|
Method
|
|
Exports all rows loaded within the Grid to Excel, XML, CSV, TSV, HTML or JSON.
The first parameter of the export method determines the export's type - 'xls', 'xml', 'html', 'json', 'pdf', 'tsv' or 'csv'.
The second parameter is the file's name. If you don't provide a file name, the Grid will export the data to a local variable.
For example:
var data = $("#jqxgrid").jqxGrid('exportdata', 'json');
The third parameter is optional and determines whether to export the column's header or not. Acceptable values are - true and false. By default, the exporter exports the columns header.
The fourth parameter is optional and determines the array of rows to be exported. By default all rows are exported. Set null, if you want all rows to be exported.
The fifth parameter is optional and determines whether to export hidden columns. Acceptable values are - true and false. By default, the exporter does not export the hidden columns.
The sixth parameter is optional and determines the url of the export server. By default, the exporter is hosted on a jQWidgets server.
The last parameter is optional and determines the char set.
Parameter |
Type |
Description |
dataType |
String |
|
fileName(optional) |
String |
|
exportHeader |
Boolean |
|
rows |
Array |
|
exportHiddenColumns |
Boolean |
|
serverURL |
String |
|
charSet |
String |
|
Return Value
None
Code example
Invoke the exportdata method.
$("#jqxGrid").jqxGrid('exportdata', 'json', 'jqxGrid');
Code example with custom URL parameter
$("#jqxGrid").jqxGrid('exportdata', 'json', 'jqxGrid', true, null, true, http://www.myserver.com/save-file.php);
Export to Excel works with the ExcelML format. ExcelML is XML-based file format. It complies to the Microsoft XMLSS specification and is supported in Microsoft Office 2003 and later.
* When you open export to Excel, you may receive the following message: "The file you are trying to open, 'file_name.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening this file. Do you want to open the file now?"
The reason of this warning message is explained in details in the following post: excel-2007-extension-warning.aspx
* Data export to PDF requires a browser with HTML5 support.
|
Save/Load State(requires jqxgrid.storage.js)
|
|
|
|
|
|
|
|
|
getstate
|
Method
|
|
Gets the Grid's state. the getstate method gets the following information: 'sort column, sort order, page number, page size, applied filters and filter row values, column widths and visibility, cells and rows selection and groups.
The returned value is a JSON object with the following fields:
- width - the Grid's width.
- height - the Grid's height.
- pagenum - the Grid's page number.
- pagesize - the Grid's page size.
- pagesizeoptions - the Grid's page size options - an array of the available page sizes.
- sortcolumn - the Grid's sort column. The value is the column's datafield or null, if sorting is not applied.
- sortdirection - JSON Object with two boolean fields: 'ascending' and 'descending'.
- filters - the applied filters. See the 'getfilterinformation' method.
- groups - the Grid's groups array which contains the grouped columns data fields.
- columns - an array of Columns. Each column in the array has the following fields:
- width - column's width.
- hidden - column's visible state.
- pinned - column's pinned state.
- groupable - column's groupable state.
- resizable - column's resizable state.
- draggable - column's draggable state.
- text - column's text.
- align - column's align.
- cellsalign - column's cells align.
Parameter |
Type |
Description |
None |
|
|
Return Value
Object
Code example
Invoke the getstate method.
var state = $("#jqxGrid").jqxGrid('getstate');
|
loadstate
|
Method
|
|
Loads the Grid's state. the loadstate method loads the following information: 'sort column, sort order, page number, page size, applied filters and filter row values, column widths and visibility, cells and rows selection and groups.
Parameter |
Type |
Description |
stateObject |
Object |
The state object returned by saveState method call. |
Return Value
None
Code example
Invoke the loadstate method.
$("#jqxGrid").jqxGrid('loadstate');
Code example with state object returned from the 'savestate' method.
Invoke the loadstate method.
$("#jqxGrid").jqxGrid('loadstate', state);
|
savestate
|
Method
|
|
Saves the Grid's current state. the savestate method saves the following information: 'sort column, sort order, page number, page size, applied filters and filter row values, column widths and visibility, cells and rows selection and groups.
The method saves the Grid's state, but also returns a JSON object with the state. In case of browsers that do not support localStorage, you can pass the state object to the 'loadState' method.
Parameter |
Type |
Description |
None |
|
|
Return Value
None
Code example
Invoke the savestate method.
var state = $("#jqxGrid").jqxGrid('savestate');
|