@@ -390,7 +390,7 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
390
390
this . _identifierVar = results . objectIdFieldName ;
391
391
/*set up layout*/
392
392
//set first column to magnifying glass icon
393
- layout . push ( { 'name' : "Zoom To " , 'field' : "" , 'formatter' : lang . hitch ( this , "_renderCell" ) , 'sort ' : false } ) ;
393
+ layout . push ( { 'name' : "" , 'field' : "" , 'formatter' : lang . hitch ( this , "_renderCell" ) , 'width ' : '22px' } ) ;
394
394
395
395
396
396
for ( var j = 0 ; j < results . fields . length ; j ++ ) {
@@ -419,9 +419,10 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
419
419
structure : layout ,
420
420
autoHeight : true ,
421
421
autoWidth : true ,
422
- rowSelector : '20px' , //width of the row selector at the beginning of a row
422
+ selectionMode : 'single' ,
423
+ rowSelector : '1px' , //width of the row selector at the beginning of a row
423
424
canSort : function ( colIndex ) {
424
- return colIndex != 0 ;
425
+ return colIndex != 0 ; //don't allow the first column (zoom to) to be sortable
425
426
} ,
426
427
plugins : {
427
428
exporter : true ,
@@ -434,6 +435,14 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
434
435
}
435
436
} ) ;
436
437
438
+ //set a click event listener on the grid to catch elements within it with the css class "zoomImg"
439
+ //the magnifying glass images added to the cell during row formatting are given the class "zoomImg"
440
+ //setting this on the grid, and not individual image nodes prevents resizing the grid from removing
441
+ //the click event.
442
+ on ( this . _resultsGrid , on . selector ( ".zoomImg" , "click" ) , lang . hitch ( this , function ( e ) {
443
+ this . _zoomToFeature ( e ) ;
444
+ } ) ) ;
445
+
437
446
//for exporting all rows of query results
438
447
function exportAll ( ) {
439
448
dijit . byId ( "grid" ) . exportGrid ( "csv" , function ( str ) {
@@ -563,14 +572,10 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
563
572
fpI . show ( ) ;
564
573
565
574
//Grid does not draw correctly on first show of floating pane, call resize after pane is open to make sure grid fits its container correctly.
575
+ //(This probably is doubled edged by product of using the EnhancedGrid inside a Floating Pane.)
566
576
//Must add click event to icon AFTER the resize event, or the handle to the click event is lost.
567
577
var ti = setTimeout ( lang . hitch ( this , function ( ) {
568
578
this . _resultsGrid . resize ( ) ;
569
- //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.
570
- //this must be done AFTER the grid is rendered with results and the zoom icons exist in the DOM.
571
- dojoquery ( ".zoomImg" ) . on ( "click" , lang . hitch ( this , function ( e ) {
572
- this . _zoomToFeature ( e ) ;
573
- } ) ) ;
574
579
} ) , 100 ) ;
575
580
576
581
} // end if (symbol != null)
0 commit comments