Skip to content

Handsontable module methods

In the following functions, tableId always refers to the unique id of a single table in the GUI, as defined in the Handsontable.create function with the tableId parameter.

Handsontable.create

Handsontable.create(tableId, step, widgetId, height = 512, options = list())

Create a new table widget. This function must be called before entering the GUI containing the table.

  • tableId is a unique name you give to the grid;
  • step is the step where the table will be, created with rpgm.step();
  • widgetId is the id of the label widget that will contain the table;
  • height is the height of the grid in pixels;
  • options is the table options as defined by the Handsontable parameters.

Please note that the module only accept a data frame with the data option with some additionnal checks and option setup:

  • The height option of Handsontable will be automatically set to the height parameter of the function;
  • If the rowHeaders is set to TRUE, it will be replaced by the row names of the data frame;
  • If the colHeaders is set to TRUE, it will be replaced by the columns names of the data frame;
  • If no columns option are set, the module will automatically call the Handsontable.getColumnsFromDF function to generate this option.

Handsontable.getColumnsFromDF

Handsontable.getColumnsFromDF(df)

Return a list of column object to use with the columns option of Handonstable. If columns is not specified, the module automatically call this function on the data frame for the columns option. See here for the option and here for cell types.

Handsontable.injectRowNames

Handsontable.injectRowNames(df, columnName)

Extract the row names from a data frame and add them to a new column as the first column of the df, named columnName. This function is for convenient changing a data frame because Handonstable does not allow modifying row names, and do not correctly work with sorting and custom row names.

Handsontable.on

Handsontable.on(tableId, eventName, callback)

Add a new event listener. See the Events section for more information.

Handsontable.off

Handsontable.off(tableId, eventName, callback)

Remove an existing event listener. See the Events section for more information.

Handsontable.update

Handsontable.update(tableId, options)

Update the settings and data of a table by overwriting its options.