<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Dojo Combobox Performance in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370863#M34405</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking for suggestions to make a combobox perform better. The problem is that I have a large dataset (appx 75k values) which I'm populating into the combobox. This is done via a query of a sql table. Then the query results are processed by adding them to an array which is used as the data store (itemFileReadStore).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The main problem is that it is quite slow when user starts typing a value or tries to pick a value from the dropdown list. Like several seconds delay. Not too surprising, given the size of the data store...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, are there ways to improve performance with the itemFileReadStore? Is there a better data store to use? JsonRest? I do have the pagesize attribute of the combobox set to 20, which helps a bit....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The app is at jsapi 2.8. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is code which programatically creates combobox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function createAssetSearch() {
&amp;nbsp; //create label for search input
&amp;nbsp; var assetSearchLabel = dojo.create("div", {innerHTML:"Asset Search", style: { display: "inline", padding: "5px", position: "relative", top: "3px"}});
&amp;nbsp; var assetSelect = new dijit.form.ComboBox({
&amp;nbsp;&amp;nbsp;&amp;nbsp; name: 'assetSelect',
&amp;nbsp;&amp;nbsp;&amp;nbsp; pageSize: 20,
&amp;nbsp;&amp;nbsp;&amp;nbsp; maxHeight: 300,
&amp;nbsp;&amp;nbsp;&amp;nbsp; id: 'assetFilterSelect',
&amp;nbsp;&amp;nbsp;&amp;nbsp; fetchProperties: { sort: [{attribute:"name",descending: false}] },
&amp;nbsp;&amp;nbsp;&amp;nbsp; onMouseEnter: function() {clearDefaultValue(this.value);},
&amp;nbsp;&amp;nbsp;&amp;nbsp; onChange: function() {zoomSetup(this.value);}, //needs to be a reference to a function, not a direct function call
&amp;nbsp;&amp;nbsp;&amp;nbsp; value: 'ex. 198802' 
&amp;nbsp; }, dojo.doc.createElement('div'));
 
&amp;nbsp; dojo.byId('webmap-toolbar-center').appendChild(assetSearchLabel);
&amp;nbsp; dojo.byId('webmap-toolbar-center').appendChild(assetSelect.domNode); //need to pad item so it is not right next to
&amp;nbsp; //execute funtion which populates asset dropdown dijit
&amp;nbsp; queryAssets();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the function to populate it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function populateAssetList(results) {
&amp;nbsp; //Populate the dropdown list box with unique values
&amp;nbsp; var asset, values = [];
&amp;nbsp; var features = results.features;
&amp;nbsp; dojo.forEach (features, function(feature) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; asset = feature.attributes.ASSETNUMBER;
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = feature.attributes.LAYER
&amp;nbsp;&amp;nbsp;&amp;nbsp; values.push({name:asset,layer:layer});
&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; var dataItems = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; identifier: 'name',
&amp;nbsp;&amp;nbsp;&amp;nbsp; label: 'name',
&amp;nbsp;&amp;nbsp;&amp;nbsp; items: values
&amp;nbsp; };
&amp;nbsp; store = new dojo.data.ItemFileReadStore({data:dataItems});&amp;nbsp; 
&amp;nbsp; dijit.byId("assetFilterSelect").store = store; 
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Jul 2013 16:06:31 GMT</pubDate>
    <dc:creator>ZorbaConlen</dc:creator>
    <dc:date>2013-07-02T16:06:31Z</dc:date>
    <item>
      <title>Dojo Combobox Performance</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370863#M34405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Looking for suggestions to make a combobox perform better. The problem is that I have a large dataset (appx 75k values) which I'm populating into the combobox. This is done via a query of a sql table. Then the query results are processed by adding them to an array which is used as the data store (itemFileReadStore).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The main problem is that it is quite slow when user starts typing a value or tries to pick a value from the dropdown list. Like several seconds delay. Not too surprising, given the size of the data store...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, are there ways to improve performance with the itemFileReadStore? Is there a better data store to use? JsonRest? I do have the pagesize attribute of the combobox set to 20, which helps a bit....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The app is at jsapi 2.8. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is code which programatically creates combobox&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function createAssetSearch() {
&amp;nbsp; //create label for search input
&amp;nbsp; var assetSearchLabel = dojo.create("div", {innerHTML:"Asset Search", style: { display: "inline", padding: "5px", position: "relative", top: "3px"}});
&amp;nbsp; var assetSelect = new dijit.form.ComboBox({
&amp;nbsp;&amp;nbsp;&amp;nbsp; name: 'assetSelect',
&amp;nbsp;&amp;nbsp;&amp;nbsp; pageSize: 20,
&amp;nbsp;&amp;nbsp;&amp;nbsp; maxHeight: 300,
&amp;nbsp;&amp;nbsp;&amp;nbsp; id: 'assetFilterSelect',
&amp;nbsp;&amp;nbsp;&amp;nbsp; fetchProperties: { sort: [{attribute:"name",descending: false}] },
&amp;nbsp;&amp;nbsp;&amp;nbsp; onMouseEnter: function() {clearDefaultValue(this.value);},
&amp;nbsp;&amp;nbsp;&amp;nbsp; onChange: function() {zoomSetup(this.value);}, //needs to be a reference to a function, not a direct function call
&amp;nbsp;&amp;nbsp;&amp;nbsp; value: 'ex. 198802' 
&amp;nbsp; }, dojo.doc.createElement('div'));
 
&amp;nbsp; dojo.byId('webmap-toolbar-center').appendChild(assetSearchLabel);
&amp;nbsp; dojo.byId('webmap-toolbar-center').appendChild(assetSelect.domNode); //need to pad item so it is not right next to
&amp;nbsp; //execute funtion which populates asset dropdown dijit
&amp;nbsp; queryAssets();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the function to populate it&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function populateAssetList(results) {
&amp;nbsp; //Populate the dropdown list box with unique values
&amp;nbsp; var asset, values = [];
&amp;nbsp; var features = results.features;
&amp;nbsp; dojo.forEach (features, function(feature) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; asset = feature.attributes.ASSETNUMBER;
&amp;nbsp;&amp;nbsp;&amp;nbsp; layer = feature.attributes.LAYER
&amp;nbsp;&amp;nbsp;&amp;nbsp; values.push({name:asset,layer:layer});
&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; var dataItems = {
&amp;nbsp;&amp;nbsp;&amp;nbsp; identifier: 'name',
&amp;nbsp;&amp;nbsp;&amp;nbsp; label: 'name',
&amp;nbsp;&amp;nbsp;&amp;nbsp; items: values
&amp;nbsp; };
&amp;nbsp; store = new dojo.data.ItemFileReadStore({data:dataItems});&amp;nbsp; 
&amp;nbsp; dijit.byId("assetFilterSelect").store = store; 
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 16:06:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370863#M34405</guid>
      <dc:creator>ZorbaConlen</dc:creator>
      <dc:date>2013-07-02T16:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dojo Combobox Performance</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370864#M34406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Maybe you could try dojox/data/QueryReadStore to try and limit the results you get back.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://dojotoolkit.org/reference-guide/1.9/dojox/data/QueryReadStore.html" rel="nofollow noopener noreferrer" target="_blank"&gt;https://dojotoolkit.org/reference-guide/1.9/dojox/data/QueryReadStore.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are some snippets from a project I have where I use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// Define my custom QueryReadStore behavior
var ParcelStore = declare([QueryReadStore], {
&amp;nbsp; fetch: function(request) {
 request.serverQuery = {
&amp;nbsp;&amp;nbsp; q: request.query.name // This is the querystring that will be used, ie - url/search?q=searchstring
 };
 return this.inherited("fetch", arguments);
&amp;nbsp; },
&amp;nbsp; requestMethod: 'get'
});&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
// create a new instance of my QueryReadStore
var p_store = new ParcelStore({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url: url // this is a url I passed in to a function, the base URL to do my queries
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
// Create my new ComboBox with appropriate parameters
parcelSearch = new ComboBox({
 id: 'parcel-filterselect',
 name: 'parcel',
 hasDownArrow: false, // so it doesn't look like a combobox, just an input
 placeHolder: 'Parcel Number...',
 store: p_store, // the custom QueryReadStore I created above
 autoComplete: true,
 style: 'width: 131px;',
 tooltip: 'Enter a parcel number',
 searchAttr: 'name',
 pageSize: 10 // so it doesn't blow up you vertical scroll
}, 'parcel-filterselect');
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This has worked pretty good for me in the past.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 17:11:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370864#M34406</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T17:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dojo Combobox Performance</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370865#M34407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Depending on what browsers you need to support, you may be able to use an HTML datalist element with an input element to provide an auto-completing input text box.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need a drop down list, you can try using a regular HTML select tag and use JavaScript to add option elements.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Jul 2013 23:23:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370865#M34407</guid>
      <dc:creator>JeffJacobson</dc:creator>
      <dc:date>2013-07-02T23:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dojo Combobox Performance</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370866#M34408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the idea Jacob. I'll look into it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Jul 2013 13:43:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/dojo-combobox-performance/m-p/370866#M34408</guid>
      <dc:creator>ZorbaConlen</dc:creator>
      <dc:date>2013-07-03T13:43:33Z</dc:date>
    </item>
  </channel>
</rss>

