I have a table in Ignition where selecting a row takes the row’s ID and uses it to run a query. I also have a button that clears the selection by setting selection.data, selectedRow, and selectedColumn to null.
In addition, I have a script that sorts the dataset based on user inputs. The sorting happens before the data reaches the table, not using the table’s built-in sorting (I mention this because I’ve read that the table’s native sorting can be finicky).
Despite all selection values being set to null, as soon as a sort occurs the 0th index row becomes selected. Even if I run a script after filtering/sorting to explicitly clear the selection, the 0th row is still selected. Also worth noting: even after setting the selection properties to null, the row remains visually highlighted.
This initially led me to believe the selection state was being stored somewhere on the JavaScript side. However, after digging through the view, I confirmed that all JavaScript selection-related keys are indeed null. Even after the sort triggers the row selection, the JavaScript objects still show no selection — which now leaves me wondering if the data is stored somewhere in Narnia.
At this point, I’m stumped on how to circumvent this behavior. I’ve tried toggling enableRowSelection to false and back to true, but that had no effect. I’ve also tried setting selectedRow and selectedColumn to -1 and then back to null, with no success.
If anyone has ideas on how to fully clear the selection and unhighlight the row, I’m all ears.
Consider editing your post to have actual paragraphs made of sentences, proper use of upper case, and organized points. Then volunteers like me won't halt partway through your wall of jumbled text.
I would highly recommend @pturmel's Integration Toolkit to do dataset manipulations in an expression to dodge scripting transforms. Much faster and efficient.
Double check and make sure that you don't have an accidental copy/pasted change script that is setting the selection to index 0.
That did it. For some reason, my designer was using cached data or something, and it was driving me crazy. I had a button that set enableRowSelection to false, but it would set it to true.
I restarted my designer and setting it to false initially and then having the dataset script enable it on update, did the trick. The only downside was that I had to add a sleep timer of .02 between disabling it and refreshing the table’s data binding seems there’s some race condition.