<docbook><section><title>OATDOCgrid</title><para> </para>
<title> grid.js</title> grid.js
<para>Advanced grid (table) control.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Objects</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid(element, optionsObject)</bridgehead>
<para>Creates a <computeroutput>grid</computeroutput> as a child of <computeroutput>element</computeroutput>.<computeroutput>optionsObject</computeroutput> may contain:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput> <emphasis>autoNumber</emphasis></computeroutput> - Grid will automatically add the first auto-numbered column </listitem>
<listitem><computeroutput> <emphasis>rowOffset</emphasis></computeroutput> - starting offset for auto-numbered column </listitem>
<listitem><computeroutput> <emphasis>allowColumnHiding</emphasis></computeroutput> - user can toggle column visibility at runtime </listitem>
<listitem><computeroutput> <emphasis>sortFunc</emphasis></computeroutput> - custom user-specified sorting routine </listitem>
<listitem><computeroutput> <emphasis>imagePath</emphasis></computeroutput> - path to images (with trailing slash) </listitem>
<listitem><computeroutput> <emphasis>reorderNotifier</emphasis></computeroutput> - routine to be called when column reordering occurs</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> Methods</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::createRow(data, [index])</bridgehead>
<para>Adds a row.
 If <computeroutput>index</computeroutput> is present, it specifies at which index the new row should be inserted.<computeroutput>Data</computeroutput> is an array of either values or objects.
 If objects are used, they should contain:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput> <emphasis>value</emphasis></computeroutput> - cell value </listitem>
<listitem><computeroutput> <emphasis>align</emphasis></computeroutput> - one of ALIGN_ constants</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::createHeader(data)</bridgehead>
<para>Creates a header row.
 <computeroutput>Data</computeroutput> is an array of either values or objects.
 If objects are used, they should contain:</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput> <emphasis>value</emphasis></computeroutput> - cell value </listitem>
<listitem><computeroutput> <emphasis>sortable</emphasis></computeroutput> - whether this column is sortable </listitem>
<listitem><computeroutput> <emphasis>draggable</emphasis></computeroutput> - whether this column is draggable </listitem>
<listitem><computeroutput> <emphasis>resizable</emphasis></computeroutput> - whether this column is resizable </listitem>
<listitem><computeroutput> <emphasis>align</emphasis></computeroutput> - one of <computeroutput>ALIGN_</computeroutput> constants </listitem>
<listitem><computeroutput> <emphasis>sort</emphasis></computeroutput> - one of <computeroutput>SORT_</computeroutput> constants </listitem>
<listitem><computeroutput> <emphasis>type</emphasis></computeroutput> - one of <computeroutput>TYPE_</computeroutput> constants</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::appendHeader(data, [index])</bridgehead>
<para>Adds a new header cell.
 If <computeroutput>index</computeroutput> is present, it specifies at which index the new cell should be inserted.<computeroutput>Data</computeroutput> are in the same format as in <computeroutput>OAT.Grid::createHeader().</computeroutput></para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::fromTable(table)</bridgehead>
<para>Converts an existing <computeroutput>table</computeroutput> into a grid.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::row::addCell(data, [index])</bridgehead>
<para>Adds one cell to one row.
 If <computeroutput>index</computeroutput> is present, it specifies at which index new cell should be inserted.
 <computeroutput>Data</computeroutput> are in the same format as in <computeroutput>OAT.Grid::createRow()</computeroutput>.
 This method should be called as <computeroutput>grid.rows[i].addCell()</computeroutput>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::removeColumn(index)</bridgehead>
<para>Removes one column specified by <computeroutput>index</computeroutput> from the grid.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::clearData()</bridgehead>
<para>Clears the grid (preserves header).</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::rows[index].select()</bridgehead>
<para>Selects row.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.Grid::rows[index].deselect()</bridgehead>
<para>Deselects row.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Constants</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GridData.LIMIT</bridgehead>
<para>Sets the minimal width of the column.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GridData.ALIGN_</bridgehead>
<para>Column alignment.</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput><emphasis>OAT.GridData.ALIGN_CENTER</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.ALIGN_LEFT</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.ALIGN_RIGHT</emphasis> </computeroutput></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GridData.SORT_</bridgehead>
<para>Column sorting order.</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput><emphasis>OAT.GridData.SORT_NONE</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.SORT_ASC</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.SORT_DESC</emphasis> </computeroutput></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3"> OAT.GridData.TYPE_</bridgehead>
<para>Constants specifying the data type in a column.
 They affect sorting - string or numeric sorts will be used based on these constants.
 When set to auto, simple detection test (parsing a float of the first row) will be performed.</para>
<itemizedlist mark="bullet" spacing="compact"><listitem><computeroutput><emphasis>OAT.GridData.TYPE_AUTO</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.TYPE_STRING</emphasis></computeroutput> </listitem>
<listitem><computeroutput><emphasis>OAT.GridData.TYPE_NUMERIC</emphasis></computeroutput></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2"> CSS classes</bridgehead>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .grid</bridgehead>
<para>CSS class of grid table element.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .even</bridgehead>
<para>CSS class of even and odd rows.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .odd</bridgehead>
<para>CSS class of even and odd rows.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .hover</bridgehead>
<para>CSS class of hovered row.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .index</bridgehead>
<para>CSS class of the first column (index) when auto numbering option is active.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .header_value</bridgehead>
<para>CSS class of the header (first row) column.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3"> .row_value</bridgehead>
<para>CSS class of a regular data column.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2"> Example</bridgehead>
<programlisting>myGridInstance.rows[index].select(); 
myGridInstance.rows[index].deselect(); 
</programlisting><para> <ulink url="CategoryDocumentation">CategoryDocumentation</ulink> <ulink url="CategoryOAT">CategoryOAT</ulink> <ulink url="CategoryOpenSource">CategoryOpenSource</ulink></para>
</section></docbook>