com.extjs.gxt.ui.client.widget.grid
Class CheckColumnConfig

java.lang.Object
  extended by com.extjs.gxt.ui.client.event.BaseObservable
      extended by com.extjs.gxt.ui.client.widget.grid.ColumnConfig
          extended by com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig
All Implemented Interfaces:
Observable, ComponentPlugin

public class CheckColumnConfig
extends ColumnConfig
implements ComponentPlugin

A ColumnConfig implementation that renders a checkbox in each cell.

CheckColumnConfig is a ComponentPlugin and must be added to the Grid's list of plugins (see @link Component.addPlugin(ComponentPlugin)).

Disabled support code snippet:

    CheckColumnConfig checkColumn = new CheckColumnConfig("indoor", "Indoor?", 55) {
      protected String getCheckState(ModelData model, String property, int rowIndex,
          int colIndex) {
        return "-disabled";
      }
    };
 


Field Summary
protected  Grid<ModelData> grid
           
 
Fields inherited from class com.extjs.gxt.ui.client.widget.grid.ColumnConfig
ariaIgnore
 
Constructor Summary
CheckColumnConfig()
          Creates a new check column config.
CheckColumnConfig(java.lang.String id, java.lang.String name, int width)
          Creates a new check column config.
 
Method Summary
protected  java.lang.String getCheckState(ModelData model, java.lang.String property, int rowIndex, int colIndex)
          Returns the css style name which contains a background image representing the checkbox.
protected  void init()
           
 void init(Component component)
          Initializes the plugin when the component is created.
protected  void onMouseDown(GridEvent<ModelData> ge)
          Called when the cell is clicked.
protected  java.lang.String onRender(ModelData model, java.lang.String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store)
          Called to render each check cell.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.grid.ColumnConfig
getAlignment, getColumnStyleName, getDataIndex, getDateTimeFormat, getEditor, getHeader, getId, getNumberFormat, getRenderer, getStyle, getToolTip, getWidget, getWidth, isFixed, isGroupable, isHidden, isMenuDisabled, isResizable, isRowHeader, isSortable, setAlignment, setColumnStyleName, setDataIndex, setDateTimeFormat, setEditor, setFixed, setGroupable, setHeader, setHidden, setId, setMenuDisabled, setNumberFormat, setRenderer, setResizable, setRowHeader, setSortable, setStyle, setToolTip, setWidget, setWidth
 
Methods inherited from class com.extjs.gxt.ui.client.event.BaseObservable
addListener, callListener, fireEvent, fireEvent, getFiresEvents, getListeners, hasActiveEvent, hasListeners, hasListeners, removeAllListeners, removeListener, setFiresEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

grid

protected Grid<ModelData> grid
Constructor Detail

CheckColumnConfig

public CheckColumnConfig()
Creates a new check column config.


CheckColumnConfig

public CheckColumnConfig(java.lang.String id,
                         java.lang.String name,
                         int width)
Creates a new check column config.

Parameters:
id - the column id
name - the column name
width - the column width
Method Detail

init

public void init(Component component)
Description copied from interface: ComponentPlugin
Initializes the plugin when the component is created.

Specified by:
init in interface ComponentPlugin
Parameters:
component - the source component

getCheckState

protected java.lang.String getCheckState(ModelData model,
                                         java.lang.String property,
                                         int rowIndex,
                                         int colIndex)
Returns the css style name which contains a background image representing the checkbox. This implementation returns "-on" or "" based on a boolean model property. "-disabled" can be returned to render a disabled checkbox.

Parameters:
model - the model
property - the model property
rowIndex - the row index
colIndex - the cell index
Returns:
the css style name

init

protected void init()

onMouseDown

protected void onMouseDown(GridEvent<ModelData> ge)
Called when the cell is clicked.

Parameters:
ge - the grid event

onRender

protected java.lang.String onRender(ModelData model,
                                    java.lang.String property,
                                    ColumnData config,
                                    int rowIndex,
                                    int colIndex,
                                    ListStore<ModelData> store)
Called to render each check cell.

Parameters:
model - the model
property - the model property
config - the config object
rowIndex - the row index
colIndex - the column index
store - the list store
Returns:
the rendered HTML