Refer to https://developers.arcgis.com/javascript/latest/sample-code/widgets-featuretable-map/, I loaded ESRI's FeatureTable widge into my App. Is it possible to make single record selection rather than multiple records selection? I mean that if clicking a record, the previous selected record should be checked off. Thanks.
Solved! Go to Solution.
It is in the app I provided. Please take a look at the app and modify it to meet your needs. https://codepen.io/U_B_U/pen/rNyeRPL?editors=100
Hi there,
Yes it is possible. Just call FeatureTable.clearSelection() method right before you call FeatureTable.selectRows() method.
I modified an SDK sample for this.
Hope this helps,
-Undral
Undral: Thanks for your response. Actually, I did have used the code
myTable.on('selection-change', (event) => {
myTable.clearSelection();
event.added.forEach(function (item) { ...
It does clear the selection. However, the new-clicked row's check-on also becomes off. I wonder if there is away to keep the new-clicked row checked-on.
Hi there,
Please take a look at the test app provided above. You must clear the selection right before you call FeatureTable.selectRows() method not in response to the event.
In the test app this is how the clearSelection is called.
featureTable.clearSelection();
candidate && featureTable.selectRows(candidate.graphic);
Thanks for your response. After adding
featureTable.selectRows(candidate.graphic);
got error candidate not defined. Could you guide me how to define the variable? Thanks.
It is in the app I provided. Please take a look at the app and modify it to meet your needs. https://codepen.io/U_B_U/pen/rNyeRPL?editors=100
Your approach is right. Since my code is different somehow, I can't use yours directly till I revise my code somehow. However, I will accept yours as the solution. Thanks a lot.