-
Goal: automatically select the first row available.
-
Steps: create a table and specify the primary key, default index, etc.
-
Details: in some cases the first row gets selected, in others it doesn't.
-
Problem: Given the fact that other components may or may not rely on the data from the first row, this will result in unreliable outcomes.
Hi @emozio,
Do you have screenshots of your table configuration or an app export?
I'd be curious if the tables that are impacted have server side pagination, sorting, or some other setting that is messing with the select row event
Not currently, as most data is private. Will try to get an app export, but again, this may also lead to potentially sharing data that isn't mine.
For now, I can say that I'm using dynamic columns, along with server-side pagination. I'm not doing much more than this, to be honest.
I even tried manually selecting first row of the table after a successful data query, i.e. as a 'succes' event, but this also does not get triggered.
To be clear, in other cases it does seem to work. It's very much a chance thing.
I'm curious to what extend other users have complained about this.
Hey @emozio,
I just remembered about a similar case here.
Try adding a debounce to your select Row event, maybe that accounts for the randomness, there could be a race condition happening.
That does sound like a potential solution indeed. As the other thread mentioned, I was expecting the success handler to be kind of the final event.
However, in between fetching the data and rendering it inside the table, there might a delay, indicating the event handler to be too fast.
I guess the real solution would be to have some permanent/steady way of always selecting the first row, based on the table's selection properties.
In any case, I will try to use the debounce
solution and will let you know if that works. Thanks for thinking this through with me.
Thanks, @MiguelOrtiz!
We have one bug we're looking into where console logging the table's selected row in a transformer prevents the default row selection from working, but the workaround is to add a selectRow event on success of the table query
I think I am able to reproduce this inconsistently though. I'll check in with the table team internally and follow up here if I get any updates
I forgot to respond sooner, my apologies. I just wanted to let you all know that I've tried Buzz Lightyear's solution and this seems to work. Setting a slight delay (e.g. 500ms) between retrieving the data and selecting the first row works.
While a more consistent (i.e. reactive) solution on the grid itself would probably be a better solution this, will suffice for now.