| DHTMLX Documentation

# Excell API reference

## Methods common for all types of excells

Data access
obj.getValue() - gets current cell value;
obj.setValue(value) - sets new cell value (is not triggered to update events, "was-changed" flag is not set);
obj.getTitle() - returns text representation of the cell value:

- returns alt text of image for img excell;
- returns link value for link excell.

As last resort - the data can be set directly:

> grid.cells(i,j).cell.innerHTML=value;

Styling
obj.setFont(value) - allows to set specific font for a cell. The value is provided in the following format: (family)[-(type)]-(size):

> grid.cells(i,j).setFont("Tahoma-bold-13px");
> grid.cells(i,j).setFont("Tahoma-12pt");

obj.getFont() - returns font settings in the same format as used for setFont(1);
obj.setTextColor(val) - sets the text color of a cell;

obj.getTextColor - returns the text color of a cell(1)

obj.setBgColor(val) - sets background color of a cell;
obj.getBgColor - returns background color of a cell(1)
obj.setHorAlign(val) - sets horizontal alignment of a cell;
obj.getHorAlign - returns horizontal alignment of a cell(1)
obj.getWidth - returns current width (int value, means actual value in pixels).
Basically all style related properties can be set directly as follows:

> grid.cells(i,j).cell.style[name]=value;

(1) - the returned data is not included into the settings assigned indirectly by css classes or inherited from top containers.
Editing
obj.wasChanged() - returns "true" if a cell was changed.

Changed flag is set automatically after the cell was changed by user actions.
The flag will not be set if the value was changed by API.

The following code should be used to set the flag manually:

> grid.cell(i,j).cell.wasChanged=true;

obj.setDisabled(mode) - enable|disable the editor of a cell (checkboxes and radio buttons are rendered in the disabled state).

## Methods specific for some excells

ro, ch
obj.isChecked() - returns "true" if the cell is checked.
obj.setChecked(mode) - sets the state of a checkbox|radion button (mode - true|false).
cp
obj.getRed() - gets red component of the selected color.
obj.getGreen() - gets green component of the selected color.
obj.getBlue() - gets blue component of the selected color.
grid
grid.setSubGrid(subgrid,column, s_column) - attaches the external grid as an editor:
subgrid - grid instance which will be used as editor;
column - column in the main grid to which the sub grid will be linked;
s_column - index of a column in the sub grid, value from which will be shown in the main grid.
clist
grid.registerCList(index,list) - sets the list of values.
index - index of the column, for which clist will be used;
list - array, or comma separated list of data.
dhxCalendar, dhxCalendarA
obj.getDate() - returns the value as the Date object.
sub_row, sub_row_grid, sub_row_ajax
obj.open() - opens the sub row.
obj.close() - closes the sub row.
obj.setContent() - sets HTML content of the sub row.
sub_row_grid
obj.getSubGrid() - gets the sub grid object.
stree
grid.setSubTree(subtree,column) - attaches an external tree as an editor.
subtree - a tree instance which will be used as an editor;
column - a column in the main grid to which the sub tree will be linked.
cntr
grid.resetCounter() - forces update of the counters column.
link
obj.getContent() - returns the text part of the link.

## Inner methods

The methods given below are low-level setters, they are not supposed to be used directly (they can be used by higher-level methods or can be redefined to get custom functionality).
obj.setCValue(formated_val,real_val) - sets the content of the cell (HTML text);
obj.setCTxtValue(formated_val,real_val) - sets the content of the cell (pure text):
formated_value - the value as it will be rendered;
real_value - optional, the value which will be accessed by grid events;
obj.edit() - switches the cell to the edit state (must not be called directly);
obj.detach() - switches the cell to the normal state (must not be called directly);
obj.changeState() - changes the state of the ch|ra cell (checked|unchecked).
© DHTMLX, 2008