Is it possible to reset the row selection in a table object on a page
A table (named ‘#tableMat’) is shown with a list of items. When the user clicks on a item line, details of the selected item are shown on the right of the screen.
On this item list, the user can also use a filter on item family.
Then, by code, the table is filtered.
The problem is that if the user has already choose an item (before filtering) at, let say the 3rd line, when the filter is applyed, the line 3 is still selected.
I managed to hide the original item selected details, no problem with that, but I want to unselected the originally selected line.
I tested with $w(‘#tableMat’).refresh(); $w(‘#tableMat’).selectRow(null), $w(‘#tableMat’).selectRow(-1) without success.
Any idea
export function tableMat_rowSelect(event) {
// display some detailed information on item selected in another object on the page
// from #datasetJPNStructure"
}
export function dropdownJpn_change(event) {
// a drop down for selection of a groupid of items
let filter = wixData.filter();
let SelectedJPN = event.target.value;
if (SelectedJPN == "RESET_ALL") {
// everything should be displayed so keep filter() empty
} else {
// only items element of "selected JPN group" should be displayed
filter = filter.eq("refPnj", SelectedJPN);
}
console.log(filter);
$w("#datasetJPNStructure").setFilter(filter);
// hide the objects with extra information from previously selected item
$w('#imagePa').hide();
$w('#imagePi').hide();
// as the previously position of the selected row is still selected, unselect it
// what I tested to unselect the row previously selected
$w('#tableMat').refresh();
$w(‘#tableMat’).selectRow(null);
$w(‘#tableMat’).selectRow(-1);
Thanks, but unfortunately this code gives exactly the same behaviour. WHen I select an item (so a line), let’s say the third line of the whole list, and then use the drop down to selet items from a specific family, the third line is still selected (ie in a different color, as set in the table parameters)
I just would like to say something like “Mytable.unselectrow(3)” to reset the line 3 color
Inspect your logs. You will get → 4 ← STEPS popping up each second in your console-log. At which step → do you get your wished functionality working ???
Step 4 make the selected line disapear automatically. So, if I understand well, your idea is to store the original table data in a variable, and restore it when the user uses the dropdown to select?