<?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 Re: programmatically creating OnDemandGrid using ColumnResizer in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160511#M14972</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tracy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just got this to work (although it's a little slow right now, not sure why) on my example.&amp;nbsp; Basically after you call buildColumns() you can append "resizable: true" to the end of the gridColumns array, like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if (results.features.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns = buildColumns(results.features[0]);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns.push("resizable: true");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This worked but I'm wondering if there's a more efficient way.&amp;nbsp; Here's my full code for the queryTask.execute section:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;queryTask.execute(query, function(results) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureAttributes = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureAttributes = array.map(results.features, function(feature){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return feature.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var currentMemory = new Memory ({data:featureAttributes, idProperty:'OBJECTID'}); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gridcolumns = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results.features.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns = buildColumns(results.features[0]);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns.push("resizable: true");
&amp;nbsp;&amp;nbsp;&amp;nbsp; grid = new customGrid({
&amp;nbsp;&amp;nbsp;&amp;nbsp; columns: gridcolumns,
&amp;nbsp;&amp;nbsp;&amp;nbsp; store: currentMemory,
&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionMode: "single",
&amp;nbsp;&amp;nbsp;&amp;nbsp; cellNavigation: false,
&amp;nbsp;&amp;nbsp;&amp;nbsp; loadingMessage: "Loading data...",
&amp;nbsp;&amp;nbsp;&amp;nbsp; noDataMessage: "No results found for: " + city
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, "grid");&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 08:27:22 GMT</pubDate>
    <dc:creator>ScottGunn</dc:creator>
    <dc:date>2021-12-11T08:27:22Z</dc:date>
    <item>
      <title>programmatically creating OnDemandGrid using ColumnResizer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160510#M14971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm dynamically creating a dGrid/OnDemandGrid and I'm having a hard time getting the ColumnResizer extension to work.&amp;nbsp; Maybe it doesn't do what I think it's supposed to do?&amp;nbsp; I was expecting it to allow me to grab the edge of the header and drag the column to a larger size.&amp;nbsp; Is that not what it does? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the appropriate require definitions at the top for &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
"dgrid/OnDemandGrid", "dgrid/extensions/ColumnHider","dgrid/extensions/DijitRegistry","dgrid/extensions/ColumnResizer","dgrid/Selection",
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My grids are generated based on the results of multiple queryTasks, coming out of a set of functions based on promise/all.&amp;nbsp; I have a separate function, buildColumns, to generate the columns using the attributes of each layer.&amp;nbsp; I assume this buildColumns function is where I should tell each column that it's resizable. The grids are populated with the correct data.&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
function queryGeometryResultsHandler_toGrid(results, idx) { //format the data for the data grid
//gridList.length = 0;
 var featureAttributes = arrayUtil.map(results.features, function(feature){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; return feature.attributes;
 });
&amp;nbsp;&amp;nbsp;&amp;nbsp; var currentMemory = new Memory ({data:featureAttributes, idProperty:'OBJECTID'}); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var gridcolumns = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results.features.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns = buildColumns(results.features[0]);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
//create a titlePane in the floatingPane for each visible layer
&amp;nbsp;&amp;nbsp;&amp;nbsp; var currentLayerId = qTaskNameList[idx];//a list of layers created in query task functions, array created previously 
&amp;nbsp;&amp;nbsp;&amp;nbsp; var currentQTask = qTaskList[idx];
&amp;nbsp;&amp;nbsp;&amp;nbsp; var paneTitle = (currentLayerId.split('_').join(' '))+"&amp;nbsp; ("+results.features.length+")";//formats string to make a nice title
&amp;nbsp;&amp;nbsp;&amp;nbsp; tp = new TitlePane({ 
&amp;nbsp;&amp;nbsp;&amp;nbsp; id: 'gridPane_'+currentLayerId, 
&amp;nbsp;&amp;nbsp;&amp;nbsp; title: paneTitle, 
&amp;nbsp;&amp;nbsp;&amp;nbsp; splitter:true});
&amp;nbsp; tp.set('class', 'reportTitlePane');
&amp;nbsp;&amp;nbsp;&amp;nbsp; registry.byId("reportContainer").addChild(tp);
&amp;nbsp;&amp;nbsp;&amp;nbsp; tp.startup();

// Create Grid using structure and data defined above&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results.features.length &amp;gt; 0) { 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var grid = new (declare([Grid, ColumnHider, DijitRegistry, ColumnResizer]))({
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id:currentLayerId+'_grid', 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns: gridcolumns,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; store: currentMemory
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; grid.startup(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp.set("content", grid);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; grid.on('.dgrid-row:click', function(event){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; highlightGridSelection(event, grid, currentQTask);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp; }else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tp.set("content", "No features found");
&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; 
}
function buildColumns(feature) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var attributes = feature.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp; var columns = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var attribute in attributes) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (attributes.hasOwnProperty(attribute)) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var objects = {};
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objects.label = attribute;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objects.field = attribute;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objects.id = attribute;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objects.resizable = true;//is this in the right place??
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (attribute === "Shape.len" || attribute === 'Shape.area'&amp;nbsp; || attribute === 'OBJECTID') {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; objects.hidden = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns.push(objects);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; return columns;
}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Dec 2013 19:02:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160510#M14971</guid>
      <dc:creator>TracySchloss</dc:creator>
      <dc:date>2013-12-02T19:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: programmatically creating OnDemandGrid using ColumnResizer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160511#M14972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tracy,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just got this to work (although it's a little slow right now, not sure why) on my example.&amp;nbsp; Basically after you call buildColumns() you can append "resizable: true" to the end of the gridColumns array, like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if (results.features.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns = buildColumns(results.features[0]);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns.push("resizable: true");&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This worked but I'm wondering if there's a more efficient way.&amp;nbsp; Here's my full code for the queryTask.execute section:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;queryTask.execute(query, function(results) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var featureAttributes = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureAttributes = array.map(results.features, function(feature){&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return feature.attributes;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var currentMemory = new Memory ({data:featureAttributes, idProperty:'OBJECTID'}); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var gridcolumns = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (results.features.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns = buildColumns(results.features[0]);&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } 
&amp;nbsp;&amp;nbsp;&amp;nbsp; gridcolumns.push("resizable: true");
&amp;nbsp;&amp;nbsp;&amp;nbsp; grid = new customGrid({
&amp;nbsp;&amp;nbsp;&amp;nbsp; columns: gridcolumns,
&amp;nbsp;&amp;nbsp;&amp;nbsp; store: currentMemory,
&amp;nbsp;&amp;nbsp;&amp;nbsp; selectionMode: "single",
&amp;nbsp;&amp;nbsp;&amp;nbsp; cellNavigation: false,
&amp;nbsp;&amp;nbsp;&amp;nbsp; loadingMessage: "Loading data...",
&amp;nbsp;&amp;nbsp;&amp;nbsp; noDataMessage: "No results found for: " + city
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }, "grid");&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:27:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160511#M14972</guid>
      <dc:creator>ScottGunn</dc:creator>
      <dc:date>2021-12-11T08:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: programmatically creating OnDemandGrid using ColumnResizer</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160512#M14973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Tracy!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I missed this thread yesterday but I love troubleshooting dgrid!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I took a look at your code and didn't see anything amiss... but its hard to troubleshoot without the entire code context.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When ColumnHider or ColumnResizer fail, it usually has to do with either&amp;nbsp; the store or the column object itself being slightly malformed (even if&amp;nbsp; it appears that everything is working correctly), thus the ids for each column are generated incorrectly, causing the extensions to fail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would compare the store&amp;nbsp; object to the column object and make sure nothing is strange about how&amp;nbsp; the two structures relate to eachother. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you potentially replicate this in a &lt;/SPAN&gt;&lt;A href="http://jsfiddle"&gt;http://jsfiddle&lt;/A&gt;&lt;SPAN&gt; ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have several other theories based on previous experiences with dynamic column structures but I'd like to inspect a live demo before going into more detail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 20:02:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/programmatically-creating-ondemandgrid-using/m-p/160512#M14973</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-01-22T20:02:57Z</dc:date>
    </item>
  </channel>
</rss>

