DHTMLX Docs & Samples Explorer

Index
dhtmlxgrid

## dhtmlxGrid API Methods

#### dhtmlXGridObject Object

addRow adds row to the grid

addRowFromClipboard adds a new row from the clipboard

adjustColumnSize autosizes a column to max content size

attachEvent adds any user-defined handler to available events

attachFooter attaches an additional line to the footer

attachHeader attaches an additional line to the header

attachToObject attaches grid to some object in DOM

cellById gets a dhtmlXGridCellObject object (if no arguments then gets dhtmlXGridCellObject object of currently selected cell)

cellByIndex gets a dhtmlXGridCellObject object

cellToClipboard copies a value of cell to the clipboard

cells gets a dhtmlXGridCellObject object (if no arguments then gets dhtmlXGridCellObject object of currently selected cell)

cells2 gets a dhtmlXGridCellObject object

changePage changes current page in grid

changePageRelative changes current page in grid

changeRowId changes id of the row to the new one

checkAll checks all checkboxes in grid

clearAll deletes all rows in grid

clearAndLoad clears an existing grid state and load new XML

clearChangedState clears wasChanged state for all cells in grid

clearConfigCookie clears cookie with grid config details

clearSelection removes selection from the grid

collapseAllGroups collapses all groups

collapseGroup collapses group of rows

collectValues gets all possible values in column

copyBlockToClipboard copies content of block selection into the clipboard in csv format (delimiter as set for csv serialization)

copyRowContent copies row content to another existing row

deleteColumn deletes a column

deleteRow deletes a row from the grid

deleteSelectedRows deletes a selected row(s)

destructor destructor, removes grid and cleans used memory

detachEvent removes an event-handler

detachFooter removes the footer line from grid (opposite to attachFooter)

detachHeader removes the header line from grid (opposite to attachHeader)

disableUndoRedo disables Undo/Redo functionality in grid

doRedo ReDo

doUndo UnDo

doesRowExist determines if a row with specified id exists

editCell creates an Editor object and switch a cell to the edit mode if allowed

editStop retuns a value from editor(if presents) to cell and closes editor

enableAlterCss sets even/odd css styles

enableAutoHeight enables an autoheight of grid

enableAutoHiddenColumnsSaving enables automatic saving the column state ( hidden | shown )

enableAutoSaving enables an automatic saving of all possible params

enableAutoSizeSaving enables an automatic size saving to cookie

enableAutoWidth changes grid's container size on the fly to fit total width of grid columns

enableBlockSelection enables the block selection mode in grid

enableCSVAutoID enables mode, where ID for rows loaded from CSV autogenerated

enableCSVHeader enables recognizing the first row in CSV as header

enableCellIds enables/disables unique id for cells (id will be automatically created using the following template: “c_[RowId]_[colIndex]”)

enableColSpan enables/disables the colspan support

enableColumnMove enables the move column functionality

enableContextMenu enables/disables the context menu

enableDistributedParsing enables/disables the distributed parsing (rows are parsed portion by portion with some timeout)

enableDragAndDrop enables/disables drag-and-drop

enableDragOrder switches to the mode when dragged item, dropped in target location in the same order as they were in the source grid

enableEditEvents enables/disables events which fires excell editing, mutual exclusive with enableLightMouseNavigation

enableEditTabOnly enables/disables the mode when readonly cell is not available with tab

enableHeaderImages specifies if values passed to Header are images file names

enableHeaderMenu enables the pop up menu which allows hiding/showing columns

enableKeyboardSupport enables/disables hot keys in grid

enableLightMouseNavigation enables/disables the light mouse navigation mode (row selection with mouse over, editing with single click), mutual exclusive with enableEditEvents

enableMarkedCells sets the marked cells support to enabled or disabled state

enableMathEditing enables/disables editing of math cells

enableMathSerialization enables/disables serialization of math formulas

enableMercyDrag enables dragging without removing (copy instead of move)

enableMultiline sets the multiline rows support to enabled or disabled state

enableMultiselect sets the multiselect mode to enabled or disabled state

enableOrderSaving enables automatic column order saving to cookie

enablePaging enables the smart paging mode

enableResizing enables/disables resizing for specified columns

enableRowsHover enables/disables hovering row on mouse over

enableRowspan enables rowspan in grid

enableSmartRendering enables the smart rendering mode

enableSortingSaving enables automatic sorting state saving to cookie

enableStableSorting enables stable sorting algorithm

enableTooltips enables/disables tooltips for specified columns

enableUndoRedo enables the Undo/Redo functionality in grid

expandAllGroups expands all groups

expandGroup expands a group of rows

filterBy filters grid by mask

filterByAll forces grid filtering by registered inputs ( created by # starting shortcuts, or by makeFilter function )

findCell finds a cell in grid by value

forEachCell executes a code for each cell in a row

forEachRow executes a code for each row in a grid

forceLabelSelection affects the block selection, so it will copy|paste only visible text , not values behind

getAllRowIds gets a list of all row ids in grid

getChangedRows gets a list of IDs of changed rows

getCheckedRows gets a list of Ids of all rows with checked exCell in specified column

getColIndexById gets a column index by column id

getColType gets a column type by column index

getColTypeById gets a column type by column ID

getColWidth gets the width of specified column in pixels

getColumnId gets the column id of column specified by index

getColumnLabel gets the label of column specified by index

getColumnsNum gets number of columns in grid

getCombo gets a Combo object of specified column. Uses it to change a select box value for a cell before opening editor

getCustomCombo gets combobox specific for the cell in question

getFilterElement gets input object of filter linked to column in question

getFooterLabel gets the label of the footer specified by index

getMarked gets marked cells

getRedo gets the length of available ReDo operations

getRowAttribute gets row attribute

getRowId gets a row id by index

getRowIndex gets a row index by id (grid only)

getRowsNum returns count of row in grid ( in case of dynamic mode it will return expected count of rows )

getSelectedCellIndex gets the index of selected cell

getSelectedRowId gets a selected row id

getSortingState gets sorting state of grid

getStateOfView returns details about current grid state

getUndo gets the length of available UnDo operations

getUserData gets user Data

gridFromClipboard init grid from CSV stored in clipboard

gridToClipboard copies grid in CSV to clipboard

gridToGrid redefines this method in your code to define how grid row values should be used in another grid

gridToTreeElement redefines this method in your code to define how grid row values should be used in tree (using input parameters you can change id of new tree node, set label, set userdata blocks etc.).

groupBy groups grid content by values of specified column

hidePivot hides a pivot table related to grid, if any exists, switch grid back to normal mode

init initializes grid

insertColumn adds a new column to the grid. Can be used after grid was initialized. At least one column should be in grid

isColumnHidden gets show/hidden status of column

load loads data from an external file ( xml, json, jsarray, csv )

loadCSVFile loads grid from CSV file

loadCSVString loads grid from CSV string

loadHiddenColumnsFromCookie loads sorting order from cookie

loadOpenStates loads open state of TreeGrid in cookie

loadOrderFromCookie loads column order from cookie

loadSizeFromCookie loads grid layout from cookie

loadSortingFromCookie loads the sorting order from cookie

lockRow locks/unlocks a row for editing

makeFilter creates a filter from any input element (text filter), select (dropdown) or DIV (combobox based on dhtmlxCombo)

makePivot shows a pivot table based on grid

makeSearch creates a search box (set selection to the row with found value) from any input

mark sets selection or removes selection from specified cell

moveColumn moves a column of specified index to new position

moveRow moves a row

moveRowDown moves a row one position down if it's possible

moveRowTo moves a row

moveRowUp moves a row one position up if possible

parse loads data from local datasource ( xml string, csv string, xml island, xml object, json objecs , javascript array )

pasteBlockFromClipboard pastes content of clipboard into the block selection of grid

preventIECaching prevents caching in IE by adding random values to URL string

printView generates a print friendly view

refreshFilters refreshes filtering ( can be used if data in grid changed and filters need to be updated )

rowToClipboard copies a value of row to the clipboard

rowToDragElement redefines this method in your code to define how grid row values should be displaied while draging

saveHiddenColumnsToCookie saves hidden columns to cookie

saveOpenStates stores opene state of TreeGrid in cookie

saveOrderToCookie saves column order to cookie

saveSizeToCookie saves grid layout to cookie

saveSortingToCookie saves sorting order to cookie

selectAll selects all rows in grid, it doesn't fire any events

selectCell sets selection to specified row-cell

selectRow selects a row (and first cell of it)

selectRowById selects a row by ID

serialize gets actual xml of grid. The depth of serialization can be set with setSerializationLevel method

serializeToCSV serializes to CSV string

setAwaitedRowHeight sets a height which will be used in the smart rendering mode for row calculation, the function needs to be used if you use a custom skin for grid which changes default row height

setCSVDelimiter change csv delimiter

setCellExcellType sets excell type for cell in question

setCellTextStyle sets a style to cell

setCheckedRows sets a value for all checkboxes in specified column

setColAlign sets an align of values in columns

setColSorting sets column sort types (avaialble: str, int, date, na or function object for custom sorting)

setColTypes sets column types

setColVAlign sets a vertical align of columns

setColWidth sets the width of specified column in pixels (doesn't works with procent based grid)

setColspan dynamically sets colspan in row starting from specified column index

setColumnColor colorizes columns background.

setColumnExcellType sets excell type for all cells in specified column

setColumnHidden hides/shows a column

setColumnId sets ids to specified column.

setColumnIds sets ids to every column. Can be used then to retreive the index of the desired colum

setColumnLabel sets new column header label

setColumnMinWidth sets minimum column width ( works only for manual resizing )

setColumnsVisibility sets list of visible/hidden columns

setCustomSorting sets custom sorting (custom sort has three params - valueA,valueB,order; where order can be asc or des)

setDateFormat sets mask for date formatting in cell

setDelimiter sets delimiter character used in list values (default is ”,”)

setDragBehavior sets Drag-And-Drop behavior (child - drop as chils, sibling - drop as sibling

setDragText defines text (single and plural forms) for extended visual appearence of drag-n-drop

setEditable manages editibility of the grid

setExternalTabOrder sets elements which get focus when tab is pressed in the last or first (tab+shift) cell

setFieldName allows to define input name which will be used for data sending, name may contain next auto-replaced elements - GRID_ID - ID of grids container, ROW_ID - ID of row, ROW_INDEX - index of row, COLUMN_ID - id of column, COLUMN_INDEX - index of column

setFooterLabel sets new label for cell in footer

setHeader sets header label and default params for new headers

setIconPath sets path to external images used in grid ( tree and img column types )

setImagePath sets path to grid internal images (sort direction, any images used in editors, checkbox, radiobutton)

setInitWidths sets width of columns in pixels

setInitWidthsP sets width of columns in percents

setMathRound enables/disable rounding while math calculations

setNoHeader creates grid with no header. Called before initialization, but after setHeader. setHeader have to be called in any way as it defines number of columns

setNumberFormat sets mask for formatting numeric data ( works for [ed/ro]n excell only or oher cell types with suport for this method)

setPagingSkin allows to set custom paging skin

setPagingTemplates allows to set paging templates for default skin

setPagingWTMode configures paging with toolbar mode ( must be called BEFORE enablePaging)

setRowAttribute sets new attribute to the row

setRowColor sets background color of row (via bgcolor attribute)

setRowExcellType sets excell type for all cells in specified row

setRowHidden hides/shows row (warning! - this command doesn't affect row indexes, only visual appearance)

setRowId sets new id for row by its index

setRowTextBold sets row text BOLD

setRowTextNormal sets row text weight to normal

setRowTextStyle sets style to row

setRowspan sets rowspan with specified length starting from specified cell

setSerializableColumns configures which column must be serialized (if you do not use this method, then all columns will be serialized)

setSerializationLevel configures XML serialization

setSkin sets one of predefined css styles (xp, mt, gray, light, clear, modern)

setSortImgState sets position and visibility of sort arrow

setStyle modifies default style of grid and its elements. Call before or after Init

setTabOrder sets tab order of columns

setUserData sets user data to row

showRow scrolls row to the visible area

sortRows sort grid

startFastOperations starts fast operation mode, in such mode events are not generated, some time consuming actions applied only once, which allow to increase performance

stopFastOperations turns off fast operation mode, need to be executed to normalize view.

submitAddedRows includes additional data with info about which rows was added and which deleted, enabled by default

submitOnlyChanged includes only changed rows in form submit

submitOnlyRowID includes only row's IDS in form submit

submitOnlySelected includes only selected rows in form submit

submitSerialization includes serialized grid as part of form submit

treeToGridElement redefines this method in your code to define how tree node values should be used in grid (using input parameters you can change id of new row, values for cells, userdata blocks etc.).

uid returns unique ID

uncheckAll unchecks all checkboxes in grid

unmarkAll removes selection from all marked cell

updateCellFromClipboard sets value of cell from clipboard

updateFromXML refreshes grid from XML ( doesnt work for buffering, tree grid or rows in smart rendering mode )

updateRowFromClipboard sets value of row from clipboard