Attribute table - select large number of features

815
9
Jump to solution
05-07-2019 11:01 AM
ScottThomas1
New Contributor III

While using a published WAB application and using the filter in the attribute table, I want to select a large number of features for export to CSV. Holding shift works to select multiple entries as long as they are visible in the table on screen, but if my filter includes hundreds of entries there doesn't seem to be a way to easily select them all. If I select the first one, then hold shift & scroll to the end, then select the last, only the last entry is selected. If I run the filter and export without selecting them it exports all features, not just those filtered.

Is there a way to get the selection I'm after?

0 Kudos
1 Solution

Accepted Solutions
YannDeschenes
New Contributor II

Hello Scott,

I had the same problem and found out that ESRI is using a common dgrid component in the Attribute Table. This component(Selection.js) is found in the folder widgets\AttributeTable\dgrid.

The shift+click command doesnt not work. This is due to the fact that OnDemandList removes rows from the DOM after they are scrolled out of view, so by the time you shift+click, the originally-selected row (and any number of rows in between) is no longer rendered. See link https://github.com/SitePen/dgrid/issues/444.

The distance before which rows are removed is controlled by the farOffRemoval property.

Update the grid component in the widgets\AttributeTable\dgrid by adding the farOffRemoval property, by default it is not there.

Simply add those lines after the dgrid declaration around line 120 (return declare("dgrid.Selection", null,)

// farOffRemoval: Integer
// Defines the minimum distance (in pixels) from the visible viewport area
// rows must be in order to be removed. Setting to Infinity causes rows
// to never be removed.
farOffRemoval: Infinity,

This had work for me.

View solution in original post

9 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Scott,

   The attribute table widget tries not to load all the rows until they are needed to be displayed, so to workaround this scroll to the last record (to get all the rows drawn) then you can select the last row and then scroll to the firast row holding the shift key and it works fine.

ScottThomas1
New Contributor III

I get the same results even when I select the last result first. It behaves as if I'm selecting my second selection for the first time without selecting anything else.  I can get some selections in in bits and pieces if I don't scroll very far, but not all at once. Feel free to test it if you'd like:

https://gis.cayugacounty.us/webapp/tmo/

The test filter I applied is Acreage Calc is greater than 74.99 returning ~1700 results

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Hmm.. I guess it is just not possible with that many records.

0 Kudos
ScottThomas1
New Contributor III

Thanks anyway for taking a look.

0 Kudos
MichaelKelly3
New Contributor III

Have you tried using the Select widget? This allows you to select features and export to csv/geojson without having to select through the table:

ScottThomas1
New Contributor III

The Select widget seems to be limited to selection on the map as opposed to selection by attributes. I'll look into the Filter & Query widgets too, but I'm not very optimistic.

Ideally, the shift-select would work as expected. Other potential solutions would be an option to 'select all' filtered features listed in the table, or an option to export what is in the filtered table without having to select them first.

Thanks for the suggestion.

0 Kudos
YannDeschenes
New Contributor II

Hello Scott,

I had the same problem and found out that ESRI is using a common dgrid component in the Attribute Table. This component(Selection.js) is found in the folder widgets\AttributeTable\dgrid.

The shift+click command doesnt not work. This is due to the fact that OnDemandList removes rows from the DOM after they are scrolled out of view, so by the time you shift+click, the originally-selected row (and any number of rows in between) is no longer rendered. See link https://github.com/SitePen/dgrid/issues/444.

The distance before which rows are removed is controlled by the farOffRemoval property.

Update the grid component in the widgets\AttributeTable\dgrid by adding the farOffRemoval property, by default it is not there.

Simply add those lines after the dgrid declaration around line 120 (return declare("dgrid.Selection", null,)

// farOffRemoval: Integer
// Defines the minimum distance (in pixels) from the visible viewport area
// rows must be in order to be removed. Setting to Infinity causes rows
// to never be removed.
farOffRemoval: Infinity,

This had work for me.

ScottThomas1
New Contributor III

That did the trick! Thanks!

In the case above, I was trying to export 1704 features. The filter showed all 1704 and when I scrolled down and patiently waited for them to load I was able to select the entire list. Unfortunately the CSV only took 1000 of them due to the service itself having the maximum number of records returned set to 1000. So I also need to change my service settings if I want to capture more than 1000 features in a CSV.

YannDeschenes
New Contributor II

I am glad it work for you too!

Yes, changing parameter for your service will help also.

Apparently, we should be able to add another property in the selection.js for the CTRL-A command.

// allowSelectAll: Boolean
// If true, allow ctrl/cmd+A to select all rows.
// Also consulted by the selector plugin for showing select-all checkbox.
allowSelectAll: true,

However, it doesn't work, I am trying to understand why... I will let you know if i can found out why?