API Methods ZingGrid provides a rich API for controlling grid interactions – from re-rendering to adjusting user interactions (like paging) through JavaScript. As an object, ZingGrid comes with its own set of methods that get/set properties and manipulate its contents.
ZingGrid refers to the grid tag (<zing-grid>
) itself. Grid-specific methods include getting the current grid dimensions, refreshing the grid, and a 'ready' callback function.
For display purposes, the methods on this page are broken out by grid element, but all methods are called from the <zing-grid>
tag.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.executeOnLoad(function() {
zgRef.getHeight()
});
Description Calculates aggregate values
Parameters Type: StringDescription: The method to calculate. Options are 'sum', 'avg', 'min', 'max', and 'count'Type: ObjectDescription: The options to be used in calculating the value. Currently fieldIndex is only option.Type: ArrayDescription: The data to calculate the value on. If this is not set, it uses the grids full datasetExample Input Values Null Returns Type: StringDescription: The calculated value or empty string if the parameters don't make senseDemo Description Clears the grid state
Parameters Null Example Input Values Null Returns Null Demo Description Executes callback function when grid completes load. If grid is already loaded, it will execute immediately.
Parameters Type: functionDescription: Callback function to executeExample Input Values function() { //do something }
Returns Type: UndefinedDescription: N/ADemo Description Formats a Date
Parameters Type: String | DateDescription: The Date to formatType: StringDescription: The tokenized format to format the dateExample Input Values Null Returns Type: StringDescription: The formatted dateDemo Description Formats a Date in from now format
Parameters Type: DateDescription: The Date to formatType: BooleanDescription: Indicates if we should include 'ago/to' to indicate past/futureExample Input Values Null Returns Type: StringDescription: The formatted dateDemo Description Get the value of the aggregate
attribute. Does not return any user defined aggregate columns.
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the aggregate attribute.Demo Description Gets the value of the batch-edit
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the batch-edit-status
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the column-drag-action
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the compact
attribute
Parameters Null Example Input Values Null Returns Type: String | BooleanDescription: Value of the attributeDemo Description Gets the dir setting for the grid
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of dirDemo Description Gets the value of the gridlines
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the indexes of the current row groupings. Returns false if none
Parameters Null Example Input Values Null Returns Type: String | BooleanDescription: Index value of the row-group or false if none.Demo Description Gets the value of the height
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the language used on the grid
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the preserve-state-id
attribute
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Value of the attributeDemo Description Gets the value of the preserve-state-load
attribute
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Value of the attributeDemo Description Gets the value of the preserve-state-options
attribute
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Value of the attributeDemo Description Gets the value of the preserve-state-save
attribute
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Value of the attributeDemo Description Gets the value of the width
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the aggregate
attribute
Parameters Type: StringDescription: Value to set aggregate toExample Input Values "sum"
"avg"
"max"
"min"
"count"
"tokenized string"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the value of the batch-edit
attribute
Parameters Type: BooleanDescription: Value of batch-editExample Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the value of the batch-edit-status
attribute
Parameters Type: StringDescription: Value of the batch-edit-statusExample Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the build code and removes watermarks if it is valid. If the build code is not set on page load, it is possible to set it through this API Method.
Parameters Type: ArrayDescription: The buildcode arrayExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the column-drag
attribute
Parameters Type: BooleanDescription: Boolean value to indicate add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the column-drag-action
attribute
Parameters Type: EnumDescription: Type of drag to enableExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the compact
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the dir
attribute
Parameters Type: EnumDescription: Type of dirExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the gridlines
attribute
Parameters Type: EnumDescription: Type of gridlines to set on the gridExample Input Values "both"
"horz"
"horizontal"
"vert"
"vertical"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the group-by
attribute
Parameters Type: StringDescription: Index to set the group-byExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the height
attribute
Parameters Type: NumberDescription: Value setting the height of the gridExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the lang
attribute
Parameters Type: StringDescription: Language to set on the gridExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the license and removes watermarks if it is valid. If the license is not set on page load, it is possible to set it through this API Method
Parameters Type: ArrayDescription: The license arrayExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the preserve-state-id
attribute
Parameters Type: StringDescription: Value setting the idExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the preserve-state-load
attribute as a reference of the user defined method to call on state load
Parameters Type: StringDescription: Value setting the functionExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the preserve-state-options
attribute as a comma separated string of the options
Parameters Type: StringDescription: Value setting the optionsExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the preserve-state-save
attribute as a reference of the user defined method to call on state save
Parameters Type: StringDescription: Value setting the functionExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the record-count
attribute
Parameters Type: NumberDescription: Value setting the countExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the grid state with the options passed in
Parameters Type: StringDescription: JSON string or object setting the stateExample Input Values '{"search": "Tom", "page": 2}'
Returns Null Demo Description Sets the grid state for the given field
Parameters Type: StringDescription: Name of the state to setType: StringDescription: String, JSON string or object setting the stateExample Input Values Null Returns Null Demo Description Sets the width
attribute
Parameters Type: NumberDescription: Value setting the width of the gridExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Forces a resize event to be triggered and to partially repaint the grid. Useful when the container updates size without the window updating.
Parameters Type: BooleanDescription: Display the loading screen while updating the grid. False by defaultType: NumberDescription: The time to delay the action. This should be > the time it takes to do the CSS transition. Value in secondsExample Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo When enabled, <zg-caption>
acts as the title of the grid. Its methods get/set the caption text.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setCaption("I am the caption");
zgRef.getCaption();
Description Gets the value of the caption
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of attributeDemo Description Set the caption text
Parameters Type: StringDescription: Text to set the caption to. If no string is passed, it will remove the caption.Example Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-card>
methods allow customizing default card templates.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setCardTemplate('templateId');
Description Sets the id to reference an external template
to be used as <zg-card>
Parameters Type: StringDescription: Value of id to use the card template.Example Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-column>
methods manipulate columns by sorting, filtering, or hiding targeted columns.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.hideColumn('password');
zgRef.sortColumn('lastName', 'asc');
Description Fetches the targeted column.
Parameters Type: ArrayDescription: Field index of column to fetch.Example Input Values Null Returns Type: ObjectDescription: Column object.Demo Description Filters the column specified by column index. Note: filter
attribute must be present for this method to work.
Parameters Type: StringDescription: Index of column.Type: StringDescription: Filter string.Example Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Gets the value of the col-class
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the frozen-columns-left
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the frozen-columns-right
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the header-auto-format
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the nested-data-separator
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Hides a column based on index
Parameters Type: StringDescription: Index of column to hideExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the col-class
attribute
Parameters Type: StringDescription: Class name or function nameExample Input Values "userClassName"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the columns
property
Parameters Type: ArrayDescription: Array of column objectsExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the columns-control
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the frozen-columns-left
attribute
Parameters Type: NumberDescription: The number of columns to freeze to the leftExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the frozen-columns-right
attribute
Parameters Type: NumberDescription: The number of columns to freeze to the rightExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the header-auto-format
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the nested-data-separator
attribute
Parameters Type: StringDescription: The separator valueExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets column to be visible
Parameters Type: StringDescription: Index of column to showExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sorts the given column with the given sort direction
Parameters Type: StringDescription: Index of column to sortType: StringDescription: Sort Direction: asc, desc, or noneExample Input Values (firstName, asc)
(firstName, desc)
(firstName)
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Toggles the visibility of a column by index
Parameters Type: StringDescription: Index of column to toggleType: BooleanDescription: Visibility of columnExample Input Values (firstName, true)
(firstName, false)
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-data>
methods allow changing or grabbing data in the grid.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setData('[1, 2, 3]');
zgRef.getSrc();
Description Fetches the internal property referencing the dataset for the grid
Parameters Type: ObjectDescription: Optional, options for the data retrieval. Options are:csv: Boolean indicating if it should be sent as a csv string. Default is false. headers: Boolean indicating if headers should be included. Default is false. Only applies to csv or JSON array of arrays as JSON objects have a key already. cols: String indicating if we should return all columns or only visible. 'all' or 'visible' are options. rows: String indicating if we should return all rows or only filtered/searched. 'all' or 'visible' are options. Example Input Values { csv: true, headers: true, col: "all or visible", rows: "all or visible" }
Returns Type: Array | ObjectDescription: The dataset.Demo Description Gets the value of the src
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of attributeDemo Description Gets the value of the template-end-delimiter
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the template-start-delimiter
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Inserts a new row into the grid
Parameters Type: ObjectDescription: Data to insert into new rowType: StringDescription: If the id is already set on the new record, pass it in hereType: BooleanDescription: If you only want to do a local insert, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Refreshes all cells. Note: if using static data, original cell value will be restored.
Parameters Null Example Input Values Returns Type: UndefinedDescription: N/ADemo Description Refreshes entire grid. Useful for language change.
Parameters Null Example Input Values Returns Type: UndefinedDescription: N/ADemo Description Removes a record from the grid
Parameters Type: StringDescription: ID of the record to removeType: BooleanDescription: If you only want to remove from the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Removes a row from the grid
Parameters Type: StringDescription: Row index (0 based) of the record to removeType: BooleanDescription: If you only want to remove from the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets or updates the dataset for the grid
Parameters Type: Array | ObjectDescription: JSON dataExample Input Values [1, 2, 3]
[{firstName:"John", lastName:"Doe"}]
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the src
attribute
Parameters Type: StringDescription: Value to indicate a path to a remote data sourceExample Input Values https://cdn.zinggrid.com/datasets/users.json
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the template-end-delimiter
attribute
Parameters Type: StringDescription: Value to indicate regex expression for closing data bindingExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the template-start-delimiter
attribute
Parameters Type: StringDescription: Value to indicate regex expression for opening data bindingExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Updates a cell in the grid
Parameters Type: NumberDescription: ID of the record to updateType: NumberDescription: Field index of the cell to updateType: *Description: New ValueType: BooleanDescription: If you only want to update the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Updates a cell in the grid
Parameters Type: NumberDescription: Row index (0 based) of the cell to updateType: NumberDescription: Column index (0 based) of the cell to updateType: *Description: New ValueType: BooleanDescription: If you only want to update the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Updates a record in the grid
Parameters Type: StringDescription: ID of the record to updateType: ObjectDescription: Data to updateType: BooleanDescription: If you only want to update the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Updates a row in the grid
Parameters Type: StringDescription: Row index (0 based) of the record to updateType: ObjectDescription: Data to updateType: BooleanDescription: If you only want to update the grid and not the external datasource, set `noDataSource` to "true"Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-dialog>
methods allow customizing default dialog box text.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.customizeDialog('record-update', {
cancel: 'cancel button text',
confirm: 'confirmation button text',
title: 'dialog box title'
});
Description Closes currently opened dialogs
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Customizes the user's dialog
Parameters Type: StringDescription: The type of dialog to customize. If you set as null, the config will be applied to all dialogs. Options are:record-create record-delete record-info record-update view-error view-info view-success view-warn zg-version Type: ObjectDescription: Options for the data retrieval. Options are:cancel: Text for the Cancel Button confirm: Text for the Confirm Button title: The Title to display on the Dialog Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-editor>
enables users to make edits to the grid. Its methods can toggle the editor, set type, or grab the attribute value of the editor.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setEditor('row');
zgRef.getEditor();
Description Gets the value of the confirmations
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the creator
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the editor
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the editor-controls
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the record-duplicate
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the row-selector
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Sets the confirmations
attribute
Parameters Type: StringDescription: string value to indicate what confirmations to enableExample Input Values "batch-edit"
"batch-edit-discard"
"delete"
"disabled"
"all"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the creator
attribute
Parameters Type: StringDescription: Value of the creator modeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the editor
attribute
Parameters Type: Boolean | StringDescription: Boolean value to indicate add or remove, or string value to indicate the editor typeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the editor-controls
attribute
Parameters Type: Boolean | StringDescription: Boolean value to indicate add or remove, or string value to indicate what editor controls to addExample Input Values true
false
all
editor
remover
creator
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the record-duplicate
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the row-selector
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-filter>
methods can toggle the filter or get its attribute value.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setFilter();
zgRef.getFilter();
Description Gets the value of the filter
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Sets the filter
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-foot>
methods affect the table footer.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.getFootClass();
Description Gets the value of the foot-class
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the foot-class
attribute
Parameters Type: StringDescription: class name or function nameExample Input Values "userClassName"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-head>
methods affect the table headers.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.getHeadClass();
Description Gets the value of the head-class
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the head-class
attribute
Parameters Type: StringDescription: Class name or function nameExample Input Values "userClassName"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-icon>
methods allow adding and manipulating user defined icon sets.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.getIconSet();
Description Gets the value of the icon-set
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the icon-set
attribute
Parameters Type: StringDescription: Icon set to use in the gridExample Input Values "fa"
"fontawesome"
"font-awesome"
"custom"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-layout>
methods will adjust the current grid layout display.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setLayout('card');
Description Gets the value of the layout
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the layout-controls
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the layout
attribute
Parameters Type: EnumDescription: Value to indicate the grid layoutExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the layout-controls
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo There are two ways to open the context menu. The first way is by using the static menu which is located in the control bar at the top of the grid (when enabled). The second way is by right-clicking a cell to open the context menu.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setContentMenu();
zgRef.closeContextMenu();
Description Closes currently opened contextmenu.
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Gets the value of the columns-control
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the context-menu
attribute
Parameters Null Example Input Values Null Returns Type: String | BooleanDescription: Value of the attributeDemo Description Gets the value of the static-menu
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of attributeDemo Description Sets the context-menu
attribute.
Parameters Type: Boolean | StringDescription: Boolean value to indicate add or remove, or string value to indicate reference to id of context-menu.Example Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the static-menu
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo When enabled, pager controls are located at the bottom of the grid and provide a way to navigate through the grid. <zg-pager>
methods allow you to change pages and set page size or options.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setPager();
zgRef.setPageSize(10);
zgRef.lastPage();
Description Navigates to first page in the grid
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Gets the current page. Does not apply to cursor paging.
Parameters Null Example Input Values Null Returns Type: NumberDescription: Page indexDemo Description Gets the current page-size
Parameters Null Example Input Values Null Returns Type: NumberDescription: Page sizeDemo Description Gets the value of the page-size-card
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the page-size-row
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the pager
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Navigates to the last page in the grid
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Navigates to the next page in the grid
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Navigates to the previous page in the grid
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Changes the current page index to be the specified value
Parameters Type: NumberDescription: New page indexExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Changes the current page size to be the specified value
Parameters Type: NumberDescription: New page sizeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Changes the current page size to be the specified value in card mode
Parameters Type: NumberDescription: New card page sizeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the page size options for the pager drop down
Parameters Type: StringDescription: Comma separated list of numerical page sizesExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Changes the current page size to be the specified value in row mode
Parameters Type: NumberDescription: New row page sizeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the pager
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-row>
methods allow you to add and edit rows in the grid.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.insertRow();
Description Gets the value of the frozen-row-class
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the frozen-rows-bottom
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the frozen-rows-top
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the row-class
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the zebra
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Opens specified row in edit mode if editing is allowed
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Fetches the targeted row.
Parameters Type: NumberDescription: The index of the row to fetch.Example Input Values Returns Type: ObjectDescription: Row object.Demo Description Sets the frozen-row-class
attribute
Parameters Type: StringDescription: Class name or function nameExample Input Values "userClassName"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the frozen-rows-bottom
attribute
Parameters Type: NumberDescription: The number of rows to freeze to the bottomExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the frozen-rows-top
attribute
Parameters Type: NumberDescription: The number of rows to freeze to the topExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the row-class
attribute
Parameters Type: StringDescription: Class name or function nameExample Input Values "userClassName"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the zebra
attribute
Parameters Type: StringDescription: Class name or function nameExample Input Values "userClassName1 userClassName2"
"functionName"
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-search>
methods allow you to toggle searching capabilities.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setSearch();
Description Gets the value of the search
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Searches the grid with the search term indicated
Parameters Type: StringDescription: Search termExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the search
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-selector>
methods allow users to make a selection on the grid by outlining the selected cell(s).
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setSelector();
zgRef.getSelector();
Description Deselects all cells
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Deselects row at given 0 based index.
Parameters Type: StringDescription: Row to deselectExample Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Deselects any row selected by the row selector column
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Returns an array of selected rows
Parameters Null Example Input Values Null Returns Type: ArrayDescription: Selected DataDemo Description Gets the value of the selector
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of attributeDemo Description Selects one or more cells
Parameters Type: StringDescription: Row of cell to selectType: StringDescription: Column of cell to selectType: StringDescription: Optional end cell row for multi-cell selectionType: StringDescription: Optional end cell column for multi-cell selectionExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Selects all cells
Parameters Null Example Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Selects row at given 0 based index. Will not select if there is no selector column or index is off page.
Parameters Type: StringDescription: Row to selectExample Input Values Null Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the selector
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-sort>
methods enable sorting a column, which is triggered by clicking on column headers.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setSorter();
zgRef.getSorter();
Description Gets the value of the sort
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the current sorted column as well as the sort direction
Parameters Null Example Input Values Null Returns Type: ObjectDescription: Object containing: fieldIndex - the currently sorted column, order - the sort directionDemo Description Gets the value of the sorter
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the sort
attribute
Parameters Type: BooleanDescription: Boolean value to indicate add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the sorter
attribute
Parameters Type: Boolean | StringDescription: String value to indicate reference to custom sorter functionExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo <zg-source>
methods allow changing of the grid's data reference or source.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setSource('New Source: https://www.zinggrid.com');
Description Gets the value of the source
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attribute.Demo Description Sets the source
attribute. Not to be confused with src
attribute, the source
attribute is for citation.
Parameters Type: StringDescription: Source of the data in the gridExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Theme methods allow changing the theme of the grid. Currently, <zing-grid>
comes with a couple default themes like: Default, iOS, and Android. (Theme Methods Playground).
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.setTheme('ios');
zgRef.getTheme();
Description Gets the value of the theme
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of attributeDemo Description Sets the theme
attribute
Parameters Type: StringDescription: Value to indicate which theme to setExample Input Values default
android
ios
dark
customTheme
Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Viewport methods allow adjusting our viewport manager. The viewport manager is used to read size mutations on the window and grid.
Example Usage
const zgRef = document.querySelector('zing-grid');
zgRef.getViewport();
Description Gets the value of the viewport
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Gets the value of the viewport-pause
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the viewport-stop
attribute
Parameters Null Example Input Values Null Returns Type: BooleanDescription: Value of the attributeDemo Description Gets the value of the viewport-types
attribute
Parameters Null Example Input Values Null Returns Type: StringDescription: Value of the attributeDemo Description Sets the viewport-pause
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo Description Sets the viewport-stop
attribute
Parameters Type: BooleanDescription: Value to add or removeExample Input Values Returns Type: ZingGridDescription: Returns the component so that you can chain methods togetherDemo