Add data widget - set sort by title as default

773
2
Jump to solution
03-29-2017 11:47 AM
JasonStanton__GISP
Occasional Contributor

Greetings,

In WAB 2.3, using the add data widget, is there a way to set it to sort by title as the default?  Any assistance would be greatly appreciated!

Jason

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Jason,

   You need to make changes in two files:

[install dir]\server\apps\[app#]\widgets\AddData\search\SortOptions.js line 31:

///////////////////////////////////////////////////////////////////////////
// Copyright © 2016 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define(["dojo/_base/declare",
    "dojo/on",
    "dojo/dom-class",
    "./SearchComponent",
    "dojo/text!./templates/SortOptions.html",
    "dojo/i18n!../nls/strings",
    "dijit/form/Select"
  ],
  function(declare, on, domClass, SearchComponent, template, i18n) {

    return declare([SearchComponent], {

      i18n: i18n,
      templateString: template,

      sortField: "title",
....

[install dir]\server\apps\[app#]\widgets\AddData\search\templates\SortOptions.html line 5 and 6:

(remove the selected property from line 5 and add it to line 6)

<div class="search-sort-options">
  <label for="${id}_select" class="sort-prompt">${i18n.search.sortOptions.prompt}</label> 
  <select id="${id}_select"
    data-dojo-type="dijit/form/Select" data-dojo-attach-point="sortSelect">
    <option value="">${i18n.search.sortOptions.relevance}</option>
    <option value="title" selected="selected">${i18n.search.sortOptions.title}</option>‍‍‍‍‍‍
....

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Jason,

   You need to make changes in two files:

[install dir]\server\apps\[app#]\widgets\AddData\search\SortOptions.js line 31:

///////////////////////////////////////////////////////////////////////////
// Copyright © 2016 Esri. All Rights Reserved.
//
// Licensed under the Apache License Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
define(["dojo/_base/declare",
    "dojo/on",
    "dojo/dom-class",
    "./SearchComponent",
    "dojo/text!./templates/SortOptions.html",
    "dojo/i18n!../nls/strings",
    "dijit/form/Select"
  ],
  function(declare, on, domClass, SearchComponent, template, i18n) {

    return declare([SearchComponent], {

      i18n: i18n,
      templateString: template,

      sortField: "title",
....

[install dir]\server\apps\[app#]\widgets\AddData\search\templates\SortOptions.html line 5 and 6:

(remove the selected property from line 5 and add it to line 6)

<div class="search-sort-options">
  <label for="${id}_select" class="sort-prompt">${i18n.search.sortOptions.prompt}</label> 
  <select id="${id}_select"
    data-dojo-type="dijit/form/Select" data-dojo-attach-point="sortSelect">
    <option value="">${i18n.search.sortOptions.relevance}</option>
    <option value="title" selected="selected">${i18n.search.sortOptions.title}</option>‍‍‍‍‍‍
....
JasonStanton__GISP
Occasional Contributor

Robert, THANK YOU for the 423rd time!!

0 Kudos