Display data in Tables
  • Updated on 17 Aug 2019
  • 1 minute to read
  • Contributors
  • Print
  • Share
  • Dark
    Light

Display data in Tables

  • Print
  • Share
  • Dark
    Light

Table Message

The tableMessage displays a table within a bubble and pushes a new table to the stack in mobile (another explanation? I think this means that a bubble will appear in the conversation window and, if clicked on, a dialog window containing the table will appear).

Tables on the screen display in two modes. The first one – ‘Show Less’ – displays the first 5 rows and the second one - ‘Show More’ – displays up to 20 rows.

The table bubble should have a maximum width, according to the screen. If more columns are present, they will not be displayed.
The first column is always a hyperlink that will pop up the entire row in a small dialog window.

The developer must enable the use of tables via the Intent class - specifically by implementing the onResolution() method to call the state object's addResponse(type, message) method, which passes all messaging (including tables) via the Abstraction Layer.

state.addResponse(type, message) therefore interfaces with the Capabilities Layer, where an object of the Message type tableMessage will be implemented:

let Message = botContext.getCapability("Message");
let message = new Message();
message.tableMessage([
    {
      field1: 'field1 contact',
      field2: 12345,
      field3: true,
      field4: 'etc',
      field5: 'etc'
    },
    {
      field1: 'field1 contact',
      field2: 12345,
      field3: true,
      field4: 'etc',
      field5: 'etc'
    }
    //... More rows
  ],
  {
    title: 'Table Title',
    description: 'Description',
  },
);
tell(message, botContext);
Was this article helpful?