77define ( [ "dojo/_base/declare" , "dijit/_WidgetBase" , "dojo/dom" , "dojo/json" , "dijit/layout/ContentPane" , "dojo/data/ItemFileWriteStore" , "dojox/grid/DataGrid"
88 , "dojox/grid/EnhancedGrid" , "dojo/data/ItemFileWriteStore" , "dojox/grid/enhanced/plugins/exporter/CSVWriter" , "dojox/grid/enhanced/plugins/NestedSorting" , "../utilities/maphandler" , "dojo/_base/lang" , "dijit/registry" , "dojo/html" , "dojo/dom" , "dojo/on" , "dijit/form/Button" , "esri/request" , "dojo/dnd/move"
99 , "esri/toolbars/draw" , "esri/graphic" , "esri/symbols/SimpleMarkerSymbol" , "esri/symbols/SimpleLineSymbol" , "esri/symbols/SimpleFillSymbol" , "dojox/layout/FloatingPane"
10- , "jquery" , "dojox/widget/Standby" , "dojo/dom-construct" , "esri/tasks/query" , "dojo/_base/connect" , "../utilities/environment" , "dojo/text!./templates/querying.html" ] ,
10+ , "jquery" , "dojox/widget/Standby" , "dojo/dom-construct" , "esri/tasks/query" , "dojo/_base/connect" , "dojo/query" , " ../utilities/environment", "dojo/text!./templates/querying.html" ] ,
1111 function ( declare , WidgetBase , dom , json , ContentPane , ItemFileWriteStore , DataGrid , EnhancedGrid , ItemFileWriteStore , CSVWriter , NestedSorting , mapHandler , lang , registry , html , dom , on , Button , esriRequest , move
1212 , Draw , Graphic , SimpleMarkerSymbol , SimpleLineSymbol , SimpleFillSymbol , FloatingPane
13- , $ , Standby , domConstruct , Query , connect , environment , template ) {
13+ , $ , Standby , domConstruct , Query , connect , dojoquery , environment , template ) {
1414 return declare ( [ WidgetBase , ContentPane ] , {
1515 // The template HTML fragment (as a string, created in dojo/text definition above)
1616 templateString : template
@@ -351,6 +351,12 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
351351 var layout = [ ] ;
352352 var identifierVar = results . objectIdFieldName ;
353353 /*set up layout*/
354+ //set first column to magnifying glass icon
355+ layout . push ( { 'name' : "Zoom To" , 'field' : "" , 'formatter' : lang . hitch ( this , "_renderCell" ) } ) ;
356+
357+
358+
359+
354360 for ( var j = 0 ; j < results . fields . length ; j ++ ) {
355361 if ( results . fields [ j ] . type == "esriFieldTypeOID" ) {
356362 identifierVar = results . fields [ j ] . name ;
@@ -371,16 +377,20 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
371377 /*create a new grid*/
372378
373379 //var grid = new DataGrid({
374- var grid = new dojox . grid . EnhancedGrid ( {
380+ var grid = new EnhancedGrid ( {
375381 id : 'grid' ,
376382 store : store ,
377383 structure : layout ,
384+ autoHeight : true ,
385+ autoWidth : true ,
378386 rowSelector : '20px' , //width of the row selector at the beginning of a row
387+ escapeHTMLinData : true ,
379388 plugins : {
380389 exporter : true ,
381390 nestedSorting : true
382391 }
383392 } ) ;
393+
384394
385395 grid . setStore ( store ) ;
386396
@@ -483,19 +493,13 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
483493 //download.click(); // This will download the data file named "iMap_Results.csv".
484494 } ) ;
485495 } ) ;
486-
487-
488-
489- grid . set ( 'autoHeight' , true ) ;
490- grid . set ( 'autoWidth' , false ) ;
496+
491497 grid . update ( ) ;
492498 /*Call startup() to render the grid*/
493499 grid . startup ( ) ;
494500 /*append the new grid to the div*/
495501 grid . placeAt ( "subContainer" ) ;
496-
497-
498-
502+
499503 dijit . byId ( 'grid' ) . resize ( ) ;
500504 dijit . byId ( 'grid' ) . update ( ) ;
501505
@@ -507,6 +511,12 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
507511
508512 /*Call startup() to render the grid*/
509513 grid . startup ( ) ;
514+
515+ //use dojo/query to set a click event for all elements in the class "zoomImg", this enables using dojo/on for all elements at once.
516+ //this must be done AFTER the grid is rendered with results and the zoom icons exist in the DOM.
517+ dojoquery ( ".zoomImg" ) . on ( "click" , lang . hitch ( this , function ( e ) {
518+ this . _zoomToFeature ( e ) ;
519+ } ) ) ;
510520
511521 //document.getElementById("subContainer").style.height = (dojo.byId('floatingPane').offsetHeight - 80).toString() + "px";
512522
@@ -607,6 +617,18 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
607617 } ) . appendTo ( cboBox ) ;
608618 }
609619 }
620+ , _renderCell : function ( item ) {
621+ var img = "<img src = 'assets/zoom.png' class='zoomImg' style='cursor: pointer'/>" ;
622+ return img ;
623+ }
624+
625+ , _zoomToFeature : function ( item ) {
626+ //get graphic results layer
627+
628+ //query layer for OID
629+
630+ //zoom to graphic
631+ }
610632
611633 } ) ;
612634 } ) ;
0 commit comments