Gridjs-spreadsheet event for object selection

Is there an event we can add a listener for that will notify us when the selected object changes, similar to how we can listen for cell selection?

Example cell selection code that we currently have:

xs.on('cell-selected', (cell, ri, ci) => {
    // do stuff with the selected cell coordinates
});

Example object selection code that we would like:

xs.on('object-selected', (obj) => {
    // do stuff with the selected object
});

@jrf.att
We do not have such event but you can implement it quite simple. Please try the below code:

    let lastri = -1;
    let lastci = -1;

xs.on(‘cell-selected’, (cell, ri, ci) => {
console.log(‘cell selected:’, cell, ‘, ri:’, ri, ‘, ci:’, ci);

            if (lastri != ri || lastci != ci) {
                console.log('cell select changed');
                lastri = ri; lastci = ci;
            }
        })

@peter.zhou Unfortunately, the cell-selected event doesn’t get triggered when clicking on a chart/image, so that won’t quite work for us

@jrf.att,

We are sorry that it does not work. We need to investigate your requirements/issue a bit. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSGRIDJS-794

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@jrf.att
like the cell selected event .
we will provide shape/image selected event.

It is improved now .
Please try the below code:

           xs.on('cell-selected', (cell, ri, ci) => {
                console.log('cell selected:', cell, ', ri:', ri, ', ci:', ci);
                if (ci === -1) {
                    console.log('ci === -1 means a row selected ',ri);
                }
                if (ri === -1) {
                    console.log('ri === -1 means a column selected',ci);
                }
            }).on('cells-selected', (cell, range) => {
                console.log('range   selected:', cell, ', rang:', range);

            }).on('object-selected', (obj) => {
                console.log('obj selected id:', obj.id, ', type: ', obj.type);
            }).on('sheet-selected', (id,name) => {
                console.log('sheet selected id:', id, ', name: ',name);
            })

Please update to v23.5 ;
you need to update for both server side GridJs dll through nuget package and client side js through npmjs.

Thanks @peter.zhou, works great.

@jrf.att,
You are welcome. If you have any questions, please feel free to contact us.