Telerik RadGrid provides the following objects on the client-side:
Classes/properties
Description
RadGrid
This is the main class. You can use it to access the whole grid object. See Rad Grid Class Overview for details.
.get_masterTableView()
This is an object of type GridTableView. This object is used to access the root table in hierarchical structures.
.get_masterTableViewHeader()
.get_masterTableViewFooter()
.get_detailTables()
This collection represents the detail tables when you have a hierarchical structured grid. Every table is of type GridTableView.
.get_editItems()
This property retrieves all GridDataItem objects that are in edit mode accross all grid tables.
.get_allowMultiRowSelection()
This property is of type Boolean. When set to true, you can select multiple rows on the client.
.get_element()
Property which returns the DOM element of the grid div.
.get_id()
Property which returns the id of the grid client object.
.get_selectedItems()
Property which returns an array of the grid rows selected on the client (and all sub levels in hierarchical grid structure).
.get_headerMenu()
Property which returns the client object of the grid header context menu when switched on. Useful when you would like to customize the items in it on the client (see the javascript logic at the top of this help topic for reference).
.get_allowActiveRow()
.get_visible()
Property which determines whether the grid is visible on the client or not (style="display:none").
.set_visible()
Property which sets the grid as visible or not on the client (changing the style-> display value of the grid div).
GridTableView
Class which wraps the client-side features of the GridTableView object. Each GridTableView client instance has GridColumn and GridDataItem objects for manipulating the grid's items and columns client-side.
.get_owner()
This property is of type RadGrid and present the parent of the current object.
Returns HTML table which represents the respective table for the GridTableView object rendered on the client.
.get_dataItems()
A collection which holds all data items (objects of type GridDataItem) in the respective table.
A collection which holds all selected items (objects of type GridDataItem) in the respective table. This collection will include the selected items from the table's child tables (meaningful in hierarchical grid only).
This property retrieves the GridDataItem objects of the current table view that are in edit mode.
.get_insertItem()
This property retrieves the HTML element of the currently inserted item.
.get_columns()
A collection which holds objects of type GridColumn (the client-side objects) in the respective table.
.get_name()
String which represents the Name property (set on the server) for the corresponding GridTableView client object. Can be used to identify table in grid hierarchy client-side.
.get_isItemInserted()
.get_pageSize()
Returns the page size for the respective GridTableView object.
.set_pageSize()
Sets the page size for the respective GridTableView object.
.get_currentPageIndex()
Returns the current page index for the respective GridTableView object.
.set_currentPageIndex()
Sets the current page index for the respective GridTableView object.
.get_pageCount()
Returns the page count for the respective GridTableView object.
.get_clientDataKeyNames()
One-dimensional array which holds the key fields set through the ClientDataKeyNames property of GridTableView on the server. To extract the key values you can use the eventArgs.getDataKeyValue inside any row-related client event handler of RadGrid.
.get_parentView()
If called from a nested table view returns the parent table view (of type GridTableView) in the grid hierarchy; returns null ifcalled from the MasterTableView.
.get_parentRow()
If called from a nested table view returns the parent row (html table row - <tr>) for the current nested hierarchical table view; returns null if called from the MasterTableView.
For performance reasons, the <GridTableViewInstance>.get_dataItems() collection will be available only when you enable specific client features/events for the rows in the grid (such AllowRowResize, AllowRowSelect, OnRowClick, etc.).
If you want to reference the client object of a grid row inside a client event handler of RadGrid, make sure that you attached the RowCreated event of the control specifying an empty event handler, namely:
otherwise eventArgs.get_gridDataItem() will return null. This is due to performance reasons (avoiding the client serialization of grid items by default).
Alternative method to reference a grid row client-side is through the get_dataItems() collection.
Inside each RadGrid client event handler the first argument passed (sender) will point to the grid client object. The second argument (eventArgs) will hold reference properties/objects dependable on the respective client event. They are listed in the separate help topics linked in the next paragraph.
Event
OnGridCreating
OnGridCreated
OnGridDestroying
This event is fired when the Telerik RadGrid object is destroyed, i.e. on each window.onunload
OnMasterTableViewCreating
OnMasterTableViewCreated
Table Creation
OnTableCreating
OnTableCreated
OnTableDestroying
Column Creation
OnColumnCreating
OnColumnCreated
OnColumnDestroying
Column Resizing
OnColumnResizing
This event is fired before a column is resized.
OnColumnResized
Columns Ordering
OnColumnSwaping
OnColumnSwaped
OnColumnMovingToLeft
OnColumnMovedToLeft
OnColumnMovingToRight
OnColumnMovedToRight
Row Creation
OnRowCreating
OnRowCreated
OnRowDestroying
Row Resizing
OnRowResizing
This event is fired before a row is resized.
OnRowResized
Row Selection
OnRowSelecting
This event is fired before row selection.
OnRowSelected
OnRowDeselecting
This event is fired before row deselection.
OnRowDeselected
OnClick and OnDblClick Events
OnRowClick
This event is fired when a row is clicked.
OnRowDblClick
OnColumnClick
This event is fired when a column is clicked.
OnColumnDblClick
Mouse Events
OnRowMouseOver
This event is fired when the mouse hovers over a row.
OnRowMouseOut
OnColumnMouseOver
This event is fired when the mouse hovers over a column.
OnColumnMouseOut
Context Menus
OnColumnContextMenu
This event is fired when the context menu for a column is called.
OnRowContextMenu
This event is fired when the context menu for a row is called.
Column Visibility
OnColumnHiding
This event is fired before a column is hidden.
OnColumnHidden
This event is fired after a column is hidden.
Row Visibility
OnRowHiding
This event is fired before a row is hidden.
OnRowHidden
This event is fired after a row is hidden.
Row Deletion
OnRowDeleting
This event is fired before a row is deleted (client-side delete).
OnRowDeleted
This event is fired after a row is deleted (client-side delete).
Hierarchy Expansion
OnHierarchyExpanding
This event is fired when the hierarchy is being expanded.
OnHierarchyExpanded
This event is fired when the hierarchy has been expanded.
OnHierarchyCollapsing
This event is fired when the hierarchy is being collapsed.
OnHierarchyCollapsed
This event is fired when the hierarchy has been collapsed.
Group Expansion
OnGroupExpanding
This event is fired when the group is being expanded.
OnGroupExpanded
This event is fired when the group has been expanded.
OnGroupCollapsing
This event is fired when the group is being collapsed.
OnGroupCollapsed
This event is fired when the group has been collapsed.
PopUp
OnPopUpShowing
This event is fired when the pop-up edit form is being shown.
Column Showing
OnColumnShowing
This event is fired before a column is shown.
OnColumnShown
This event is fired after a column is shown.
Row Showing
OnRowShowing
This event is fired before a row is shown.
OnRowShown
This event is fired when the row is shown.
Row Drag and Drop
OnRowDragStarted
This event is fired when a row is about to be dragged.
OnRowDropping
This event is fired before a row is dropped.
OnRowDropped
This event is fired after a row is dropped.
Active Row Changing
OnActiveRowChanging
This event is fired before the active row change.
OnActiveRowChanged
This event is fired after the active row is changed.
Filter Menu
OnFilterMenuShowing
This event is fired before the filtering menu is rendered.
Data Binding
OnRowDataBound
This event is fired when a row is about to be bound on the client.
OnDataBinding
This event is fired when the grid is about to be bound on the client.
OnDataBound
This event is fired right after the grid is bound on the client.
Scrolling
OnScroll
This event is fired when you scroll the grid.
Command
OnCommand
This event is fired for each grid command which is about to be triggered (sorting, paging, filtering, editing, etc.) before postback/ajax request .
A collection which holds all data items (objects of type GridDataItem) in the respective table
You can further refer to the elements of the RadGridTable using the functions below:
<GridTableViewInstance>.get_columns()[n].get_element() -> the real HTML table column for the n-th column(<th> for header cell)<GridTableViewInstance>.get_dataItems()[n].get_element() -> the real HTML table row for the n-th row (<tr> element)
Telerik RadGrid provides means for client-side manipulation of the table elements.
Method
selectItem (gridItem)
The row passed as an argument will become selected.
deselectItem(gridItem)
The row passed as an argument will become deselected.
clearSelectedItems()
hideItem(index)
The row at position rowIndex will be hidden.
showItem(index)
The row at position rowIndex will be shown.
expandItem(index)
Method which expands the table row with index passed as an argument. If the index corresponds to nested table item, all parent items will be expanded to top.Applicable for HierarchyLoadMode = Client only!
collapseItem(index)
Applicable for HierarchyLoadMode = Client only!
editItem(gridItem)
Method which switches the table row passed as an argument or the row corresponding to the index passed as an argument in edit mode. If you set AllowMultiRowEdit to true, you can switch multiple grid items in edit mode with subsequent calls to this method.
updateItem(gridItem)
insertItem()
deleteItem(gridItem)
showInsertItem()
cancelInsert()
cancelUpdate(gridItem)
editSelectedItems()
Method which switches all selected items in the grid in edit mode.
updateEditedItems()
deleteSelectedItems()editSelectedItems
editAllItems()editSelectedItems
cancelAll()
resizeItem (rowIndex, rowHeight)
The row at the specified row index will be resized to the height specified through the rowHeight argument.
showFilterItem()
Shows the filter item for the respective GridTableView
hideFilterItem()
Hides the filter item for the respective GridTableView
extractValuesFromItem(gridItem)
Extracts the new values from the edited table row on the client.
extractKeysFromItem(gridItem)
Extracts the key values from the edited table row on the client.
resizeColumn(columnIndex, columnWidth)
The column at the specified columnIndex will be resized to the width specified through the columnWidth argument.
swapColumns(colUniqueName1, colUniqueName2)
The columns with unique names colUniqueName1 and colUniqueName2 will be swapped.
reorderColumns(swapColumns
colUniqueName1 is the "from" unique name of the table column while colUniqueName2 is the "to" unique name of the column (i.e. the new location).
moveColumnToLeft(columnIndex)
moveColumnToRight(columnIndex)
hideColumn(columnIndex)
showColumn(columnIndex)
groupColumn(colUniqueName)
ungroupColumn(colUniqueName)