DHTMLX Docs & Samples Explorer

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.getAttribute(name) - gets value of cell's attribute ( original value can be defined as part of XML | JSON data )datasource;
  • obj.setAttribute(name,value) - sets value of cell's attribute;
  • obj.getTitle() - returns text representation of the cell value:
    • returns alt text of image for img excell;
    • returns link value for link excell.

As the 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) - enables|disables the cell editor (checkboxes and radio buttons are rendered in the disabled state).

Other