Skip to content

Commit 2c80256

Browse files
author
Stephen Sporik
committed
Grid resize() bug fix; Styling changes
Any action that resized the Query Results grid, removed the click event from the zoom Image nodes. EnhancedGrid lacks eventing for resize() to reattach the click events. Implemented on.selector and set the event handler to the grid itself to fix the issue. Updated Row header width, and removed Zoom To column name, as well as shortened the zoom column width.
1 parent 29939b8 commit 2c80256

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

basicviewer/src/modules/core/query/querying.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
390390
this._identifierVar = results.objectIdFieldName;
391391
/*set up layout*/
392392
//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'});
394394

395395

396396
for (var j = 0; j < results.fields.length; j++) {
@@ -419,9 +419,10 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
419419
structure: layout,
420420
autoHeight: true,
421421
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
423424
canSort: function(colIndex){
424-
return colIndex != 0;
425+
return colIndex != 0; //don't allow the first column (zoom to) to be sortable
425426
},
426427
plugins: {
427428
exporter: true,
@@ -434,6 +435,14 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
434435
}
435436
});
436437

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+
437446
//for exporting all rows of query results
438447
function exportAll() {
439448
dijit.byId("grid").exportGrid("csv", function (str) {
@@ -563,14 +572,10 @@ define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/dom", "dojo/json", "dij
563572
fpI.show();
564573

565574
//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.)
566576
//Must add click event to icon AFTER the resize event, or the handle to the click event is lost.
567577
var ti = setTimeout(lang.hitch(this, function(){
568578
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-
}));
574579
}), 100);
575580

576581
} // end if (symbol != null)

0 commit comments

Comments
 (0)