Our blazing fast Grid component built with pure JavaScript


Post by dennyferra »

Using version 5.6.0

I have a grid configured with the following:

        selectedRows: ['guid-1', 'guid-2'],
        selectionMode: {
            checkbox: true,
            checkboxOnly: true,
            multiSelect: true,
        },

and an AjaxStore:

        new AjaxStore({
            autoLoad: true,
            readUrl: '/api/assets'
        });

When I load the grid I notice that the rows with guid-1 and guid-2 are not selected by default.

I played around with the selection example (https://bryntum.com/products/grid/examples/selection) and that seems to work fine, though one of the differences I noticed is that the example does not use an AjaxStore.

Does selectedRows work with AjaxStores?

Thanks!


Post by tasnim »

Hi,

You don't get this selected, because selectedRows is not config it's a property
Properties only can be set on runtime.

Please try setting them inside of a renderer and you can push records in the selectedRows

            renderer(props) {
                const { value, record, grid } = props;
                grid.selectedRows = [...grid.selectedRows, record];
                return value;
            }

Docs
https://bryntum.com/products/grid/docs/api/Grid/column/Column#config-renderer

Best of luck :),
Tasnim


Post by dennyferra »

Tasnim, your suggestion resolves my problem, thank you.


Post Reply