Row selection

tip

Install the gridjs-selection plugin if you haven't already. Follow the installation manual.

Example

Add a new column to your table definition and install the plugin. You need to define an id function for your selection plugin. The id function must return a unique string for each row and is called to determine the identifier for each row.

Live Editor
Result
note

In the example above, the 3rd cell (which is row.cell(2).data) has been selected as the row identifier which is the "Email" field. Note that the first cell is the checkbox column.

Selected rows

The selection plugin uses a Redux architecture and that means each selection instance has its own unique Store which keeps the list of selected rows.

Live Editor
Result

Row selection extension

Grid.js enables you to write custom plugins and extend the core functionality. In this example, we are developing a custom plugin which listens to the Selection plugin events and populates a list of selected rows.

Live Editor
Result
tip

Follow the Advanced Plugin article to learn more about writing Grid.js plugins!

Last updated on by Afshin Mehrabani