Skip to main content
Jump to: navigation, search

Difference between revisions of "Scout/Concepts/Table"

m (TODO)
(Summary Cell, Primary Columns)
Line 94: Line 94:
  
  
=== Summary Cell, Primary Columns ===
+
=== Summary Cell ===
 +
 
 +
{{note|TODO|Merge this post: [http://www.eclipse.org/forums/index.php/mv/msg/452690/1007940/#msg_1007940 Summary Cell]. It explain how the summary cell is used to represent the child pages in the page tree.}}
 +
 
 +
=== Primary Columns ===
 +
{{note|TODO|Describe this here or in the [[Scout/Concepts/Column#Properties|Column property]]}}
  
 
== See Also ==
 
== See Also ==

Revision as of 07:02, 8 February 2013


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitterG+
Bugzilla
Bugzilla


A table is data structure that can be represented in a TablePage or a TableField.

  • implements: I obj.pngITable
  • extends: C obj.pngAbstractTable

Description

Table can contains a set of structured data: the structure of the entity is defined by the columns. Each entity contained in the table is a row. At the intersection of a column and a row is a Cell. A Cell describes how the value is represented (displayed text, colors, style, icon...).

Example

Imagine that you want to have a table of persons that are structured as followed:

  • Name (String)
  • First name (String)
  • Age (Integer)
  • Date of birth (Date)

A such table needs to contains 4 columns :

Here is how this table looks like in the Explorer View of the SDK:

Scout sdk example table.png

Access to the data

To access a value of a table, the common pattern is to go throw the column. For example if you want to access the age of a person, at a precise row index r, the code is:

  private Integer getAgeOfPersonAtRow(int r){
    return getTable().getAgeColumn().getValue(r);
  }

Add a rows in the table

The table API (client-side) offers different ways to add rows in the table:

1: One row, with type check on set value. (you get compile error if you change something in your table):

ITableRow row = getTable().createRow();
getTable().getNameColumn().setValue(row, "Smith");
getTable().getFirstNameColumn().setValue(row, "John");
getTable().getAgeColumn().setValue(row, 42);
getTable().getBirthDateColumn().setValue(row, DateUtility.parse("14.12.1970", "dd.MM.yyyy"));
getTable().addRow(row, true);

The second parameter correspond to "mark as inserted". false (default value - if the parameter is omitted) the row will be insterted with a row Status: ITableRow.STATUS_NON_CHANGED. If true, the row will be inserted with the status ITableRow.STATUS_INSERTED.

2: One row as Object[] array.

getTable().addRowsByArray(
    new Object[]{"Johnny", "Mcgee", 26, DateUtility.parse("25.05.1986", "dd.MM.yyyy")}, 
    ITableRow.STATUS_INSERTED);

The second parameter indicate the status of the new row. ITableRow.STATUS_INSERTED is the default status (it could be omitted in this example).

3: Multiple rows as Object[][] array.

getTable().addRowsByMatrix(new Object[][]{
    new Object[]{"Isabella", "Barton", 32, DateUtility.parse("21.01.1980", "dd.MM.yyyy")},
    new Object[]{"Dana", "Reyes", 56, DateUtility.parse("16.08.1956", "dd.MM.yyyy")}
}, ITableRow.STATUS_INSERTED);

The second parameter indicate the status of the new row. ITableRow.STATUS_INSERTED is the default status (it could be omitted in this example).

For method 2 and 3 you need to be ensure that the array elements order match with the order of your table columns.

TODO

Note.png
TODO
Organize these subsections in section + subsection. Add description


deleteRow(..) / discardRow(..)

see: http://www.eclipse.org/forums/index.php/mv/msg/441016/988922/#msg_988922


Display/Hide the data (Organize Table)

Table provides support to sort, to filter how the content is represented.


Sorting possibility

properties


Selection

Table also manages selection.

properties

Menu

Table can also contains Menus, to provide a possibility to trigger some actions (Menus are displayed in the context menu of the table).


Checkable

Summary Cell

Note.png
TODO
Merge this post: Summary Cell. It explain how the summary cell is used to represent the child pages in the page tree.


Primary Columns

Note.png
TODO
Describe this here or in the Column property


See Also

Back to the top