TableChart

 

Inhalt:

  • Füllen von Daten

  • Properties

Allgemein

Detaillierte Information finden Sie zusätzlich hier: https://developers.google.com/chart/interactive/docs/gallery/table

Beispiel: Füllen der Daten

1 2 3 4 5 6 7 8 9 10 11 final ChartModel model = ChartModel.New() .addColumn(Column.New(Type.STRING, "Name")) .addColumn(Column.New(Type.NUMBER, "Salary")) .addColumn(Column.New(Type.BOOLEAN, "Full Time Employee")); model.addRow("Mike", Cell.New(10000, "$10.000"), true); model.addRow("Jim", Cell.New(8000, "$8.000"), false); model.addRow("Alice", Cell.New(12500, "$12.500"), true); model.addRow("Bob", Cell.New(7000, "$7.000"), true); tableChart.setModel(model);

API und Methoden:

Properties

 

Properties

 

AllowHTML

If set to true, formatted values of cells that include HTML tags will be rendered as HTML. If set to false, most custom formatters will not work properly.

1 this.tableChart.setAllowHtml(true);

AlternatingRowStyle

Determines if alternating color style will be assigned to odd and even rows.

1 this.tableChart.setAlternatingRowStyle(true);

FirstRowNumber

The row number for the first row in the dataTable. Used only if showRowNumber is true.

1 this.tableChart.setFirstRowNumber(5);

FrozenColumns

The number of columns from the left that will be frozen. These columns will remain in place when scrolling the remaining columns horizontally. If showRowNumber is false, setting frozenColumns to 0 will appear the same as if set to null, but if showRowNumber is set to true, the row number column will be frozen.

1 this.tableChart.setFrozenColumns(2);

Page

If and how to enable paging through the data. Choose one of the following string values:

  • 'enable' - The table will include page-forward and page-back buttons. Clicking on these buttons will perform the paging operation and change the displayed page. You might want to also set the pageSize option.

  • 'event' - The table will include page-forward and page-back buttons, but clicking them will trigger a 'page' event and will not change the displayed page. This option should be used when the code implements its own page turning logic. See the TableQueryWrapper example for an example of how to handle paging events manually.

  • 'disable' - [Default] Paging is not supported.

1 this.tableChart.setPage(ActionMode.ENABLE);

PageSize

The number of rows in each page, when paging is enabled with the page option.

1 this.tableChart.setPageSize(5);

PagingButtons

Sets a specified option for the paging buttons. The options are as follows:

  • 'both' - enable prev and next buttons

  • 'prev' - only prev button is enabled

  • 'next' - only next button is enabled

  • 'auto' - the buttons are enabled according to the current page. On the first page only next is shown. On the last page only prev is shown. Otherwise both are enabled.

  • number - the number of paging buttons to show. This explicit number will override computed number from pageSize.

1 this.tableChart.setPagingButtons(PagingButtons.Both());

RtlTable

Adds basic support for right-to-left languages (such as Arabic or Hebrew) by reversing the column order of the table, so that column zero is the rightmost column, and the last column is the leftmost column. This does not affect the column index in the underlying data, only the order of display. Full bi-directional (BiDi) language display is not supported by the table visualization even with this option. This option will be ignored if you enable paging (using the page option), or if the table has scroll bars because you have specified height and width options smaller than the required table size.

1 this.tableChart.setRtlTable(true);

ScrollLeftStartPosition

Sets the horizontal scrolling position, in pixels, if the table has horizontal scroll bars because you have set the width property. The table will open scrolled that many pixels past the leftmost column.

1 this.tableChart.setScrollLeftStartPosition(2);

ShowRowNumber

If set to true, shows the row number as the first column of the table.

1 this.tableChart.setShowRowNumber(true);

Sort

If and how to sort columns when the user clicks a column heading. If sorting is enabled, consider setting the sortAscending and sortColumn properties as well. Choose one of the following string values:

  • 'enable' - [Default] Users can click on column headers to sort by the clicked column. When users click on the column header, the rows will be automatically sorted, and a 'sort' event will be triggered.

  • 'event' - When users click on the column header, a 'sort' event will be triggered, but the rows will not be automatically sorted. This option should be used when the page implements its own sort. See the TableQueryWrapper example for an example of how to handle sorting events manually.

  • 'disable' - Clicking a column header has no effect.

1 this.tableChart.setSort(ActionMode.ENABLE);

StartPage

The first table page to display. Used only if page is in mode enable/event.

1 this.tableChart.setStartPage(1);