FeatureTable Scroll to Selection

1332
5
11-09-2017 01:02 PM
VIKRANTKRISHNA
New Contributor III

I am using FeatureTable of JavaScript API 3.19. 

featuretable is long list with scrolling and I am trying to scroll to the row when corresponding feature is selected on the map. I is have set syncSelection: true   , so table row get highlighted , but I can't find a way to scroll to the selected row.

Anyideas will really help.

Thanks,

Vik

0 Kudos
5 Replies
AaronGibson
New Contributor

Hey Vik,

You can use selectRows() function to scroll to the selected rows. You will need the the ObjectID for each row that you want selected, it will only scroll to the first one in the set.

https://developers.arcgis.com/javascript/3/jsapi/featuretable-amd.html

look for 

selectRows(ids, scrollToRow?) 

Allows users to select rows(s) based on row id(s). Selected rows will be highlighted while other records are still visible in the table. (Added at v3.18)

0 Kudos
VIKRANTKRISHNA
New Contributor III

Seems to not working for me.

I have custom panel in my app, where I am rendering the feature table. Its a custom UI design, tabs includes tabs and other div hierarchies . Could the design and css of parent container be the problem?

0 Kudos
AaronGibson
New Contributor

I don't think that would cause an issue. I use it in a complex UI as well and it works. Hard to say without seeing the application. Are you using the ArcGIS Javascript API 3.18 or higher?

0 Kudos
VIKRANTKRISHNA
New Contributor III

I am using 3.15 

0 Kudos
AlirezaAhmadi
New Contributor

FeatureTable | API Reference | ArcGIS API for JavaScript 3.25 

<Boolean> scrollToRowOptionalIndicates whether the table should scroll to selected rows. If multiple row ids are provided, scrolls to first row in the array. Default value: false. Note that if scrollToRow is true, selection only occurs if rows are already displayed within the table. This is a known limitation with Dojo's dgrid.

selection only occurs if rows are already displayed within the table

0 Kudos