0

I would like to use https://gridjs.io/ with a HTML table that is already rendered. I would also like to utilize the RowSelection Plugin. How can I do both.

Here is the code I would like to execute.

const grid = new Grid({
            sort: true,
            from: this.tableTarget,
            columns:[
                {
                    id: 'selectRow',
                    name:  'name',
                    width: "95px",
                    sort: false, 
                    plugin: {
                        component: RowSelection,
                    }
                }
            ],
            resizable: true,
            autoWidth: true
        })

Here is my table generator

<table>
<thead>
    <tr>
        <th >Selection</th>
        <th >Title</th>
        <th >ID</th>
    </tr>
</thead>
<tbody>
    <% @records.each do |task| %>
        <% helpers.decorate(task) do |task_decorator| %>
            <tr>
                <td><input type="checkbox" class="gridjs-checkbox"></td>
                <td><%= task_decorator.title %></td>
                <td><%= task.id %></td>
            </tr>
        <% end %>
    <% end %>
</tbody>
</table>

It seems to be ignoring the columns definition in the initializer.

0 Answers0