Select widget selection order

500
3
10-16-2017 04:30 PM
CarrieMunill
New Contributor

Hi everyone,

I am trying to customize the Select widget to save (or include) the ORDER of the interactive selection. Is this possible to do with the Selection widget, or indeed, with any widget? In other words, I need the interactive order to be the thing that the attribute table sorts on, rather than by a particular attribute field, in order to export the table in that order. I've not found any similar questions in my search, though if this has been asked before, kindly point me in the right direction!

Cheers,

Carrie

Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus

Carrie,

   No this is not a OTB workflow that is supported. There is also no widget OTB or custom that support this workflow (that I am aware of). The main issue will be how to get the AT widget to sort/display on that order. I can think of an easy way to make an array of ObjectId as the user selects them using the Selection Widget but then getting the AT widget to order by that is the issue. Currently I can no think of a way to do this.

0 Kudos
CarrieMunill
New Contributor

Thanks for your response Robert, I was afraid that was the case since I haven't seen it mentioned anywhere. A thought - might it be possible to pass that array to something like a csv? (I don't know how the "export to csv" functionality is actually functioning in the widgets that support it.) Or send it to a server via json? I don't really need the attribute table to show the order at all, and I only need to capture the ID of the point being selected. I'm only just getting into JavaScript (all my old apps were Flex), and don't know all the ins and outs yet.

(I did think of a very kluge-y way of manually sort of doing the same thing, using an editable FC in an enterprise geodatabase that I think would work, more or less.)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Carrie,

   If you are just getting into JS development then this may be pretty hard but this is how I export data to a csv from inside a widget:

define([
...
  'jimu/CSVUtils',
...
],
  function (
...
  CSVUtils,
...
  ) { /*jshint unused: true*/
    return declare([BaseWidget, _WidgetsInTemplateMixin], {
      currentCSVResults: null,


//When looping through your layer
var csvRow = {}, csvColumns = [];
csvColumns.push(your attribute name);
csvRow[your attribute name] = "the value of that attribute";
csvData.push(csvRow);

this.currentCSVResults = {
  data: csvData,
  columns: csvColumns
}

CSVUtils.exportCSV("the name of your layer", this.currentCSVResults.data, this.currentCSVResults.columns);
0 Kudos