Automatic sorting of the Attribute Table

252
4
Jump to solution
02-17-2018 10:07 AM
ZdeněkSoldán
Occasional Contributor

Hello,

is it possible to automatic sort values in the Attribute Table after the Table is shown in the app? What I need is to see rows with error attribute automatic on the first places.

Thanks a lot

Regards

Zdenek

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Zdenek,

In the [install dir]\server\apps\[app#]\widgets\AttributeTable\table\_featureTable.js @ line 1811 there is this code:

      if (this.layer.objectIdField) {
        this.grid.set('sort', this.layer.objectIdField, false);
      }

that automatically sorts by object id you could replace that code with your field name.

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Zdenek,

In the [install dir]\server\apps\[app#]\widgets\AttributeTable\table\_featureTable.js @ line 1811 there is this code:

      if (this.layer.objectIdField) {
        this.grid.set('sort', this.layer.objectIdField, false);
      }

that automatically sorts by object id you could replace that code with your field name.

View solution in original post

0 Kudos
ZdeněkSoldán
Occasional Contributor

Robert,

thank you a lot!

One additional question...if I want this sorting only for one layer and for all others sorting by objectIdField?

I tried add else if condition with the original code below changed if condition but it wasn't obviously good aproach.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Zednek,

   You have access to the this.layer so you can determine if it is the layer you want or not. So using an if else if absolutely the correct path.

0 Kudos
ZdeněkSoldán
Occasional Contributor

Robert,

it looks good now. Thank you again.

0 Kudos