Jaxcent for .NET

Tables in Jaxcent

The HTML TABLE tag is handled by the JaxcentTable class.

The JaxcentTable class provides several features, such as the ones found in typical "GRID" components.

Updating tables from a data source

The tables can be updated at any time, from a System.Data.DataTable or a 2-d string array, using JaxcentTable.SetTableContents method. The table rows will be grown/shrunk as necessary. If there are 1 or more header rows, they can be specified as such, so the update will not affect them.

Styling updated table rows

Growing tables involves adding new rows. If table rows are styled, the newly added rows can be given that style to follow. This can be an even/odd style, or the same style for all rows. In addition to this (or instead of this), the newly added rows can also be styled by columns. That is - an array of styles can be provided that will be applied to the individual cells, after any row-styles have been applied to the whole row.

The TableDataSource

The various parameters for updates can be set up in a TableDataSource, which specifies the DataTable or the 2-d array which is the source of the data, any header rows, and the various styles.

Hiding columns from a data source

TableDataSource provides a method for hiding one or more columns. This can be useful, for instance, if a DataTable contains "id" values which are not meant for the end user, but which are useful for internal references for that row.

Adding HTML string.Formatted columns

The TableDataSource also provides a method InsertFormattedColumn for inserting columns that are format strings to generate HTML, which can be useful for inserting check-boxes, radio-buttons, anchor HREF links, buttons etc. in the table. The HTML is formatted for each row using string.Format The current row-index, as well as the full contents for the current row source (DataTable or 2-d array) are available as arguments to string.Format. So, for instance, let's say the first column in a DataTable is an "id" column (which may or may not be hidden from display to the end user). Then a checkbox format
  <INPUT TYPE="CHECKBOX" NAME="clientid" VALUE="{0}">
will be replaced with something like
  <INPUT TYPE="CHECKBOX" NAME="clientid" VALUE="23">
where "23" is the content of the "id" column for that particular row. (Note: There should be a FORM tag around the table to make such INPUT types work in all browsers. As usual in Jaxcent, the FORM will simply need to be an empty <FORM> tag, with no requirements to have any ACTION or METHOD.)

Some other examples of format strings are:

  <BUTTON onClick="JaxcentServerRequest('id={1}'">
  <A HREF="/Details.html?id={2}">

Selecting a row in a table

Styles can be applied to a particular existing row, so the table can also show "currently selected" row by highlight it in a different style.

The table update styles can be specified as a CSS type style string, or as a class name, or as arrays of style names and values. The class TableUpdateStyles is used to set up the styles for table updates.

Granular operations on a table

Instead of updating the entire table, rows can be added, deleted, and/or their contents changed by adding/deleting/updating cells.

Various events are also available on the table.

Cell Editing

The methods JaxcentTable.EnableCellEditing and JaxcentTable.DisableCellEditing can be used to enable/disable cell editing on particular cells. When enabled, cell editing allows the end-user to click on a particular cell and change its content. The changed contents can be retrieved by querying them, by taking advantage of the form and automatic data retrieval features, and/or by handling the JaxcentTable.OnCellEdited event.