Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9072377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:09:15+00:00 2026-06-16T18:09:15+00:00

I have a grid that populates from a search event and I’d like the

  • 0

I have a grid that populates from a search event and I’d like the option of being able to close the grid by simply adding an X in the top right corner, similar to how you close any browser or window. I thought it would be as easy as adding the X, styling it to my liking and then creating an onclick event that would close or hide the grid… but I can’t seem to get that working. Any help would be appreciated.

My JS is:

dojo.require("dojox.grid.DataGrid"); //FindTask
dojo.require("dojo.data.ItemFileReadStore"); //FindTask
dojo.require("esri.tasks.find"); //FindTask

var findTask, findParams;
var grid, store;
var searchExtent;

function doFind() {

            //Show datagrid onclick of search button and resize the map div.
            esri.show(datagrid);
            dojo.style(dojo.byId("content"), "height", "83%");
            searchExtent = new esri.geometry.Extent ({
            "xmin":-9196258.30121186,"ymin":3361222.57748752,"xmax":-9073959.055955742,"ymax":3442169.390441412,"spatialReference":{"wkid":102100}
            });

            map.setExtent(searchExtent);

    //Set the search text to the value in the box
    findParams.searchText = dojo.byId("parcel").value;
            grid.showMessage("Loading..."); //Shows the Loading Message until search results are returned.
    findTask.execute(findParams,showResults);
  }

  function showResults(results) {
    //This function works with an array of FindResult that the task returns
    map.graphics.clear();
    var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5]));


    //create array of attributes
    var items = dojo.map(results,function(result){
      var graphic = result.feature;
      graphic.setSymbol(symbol);
      map.graphics.add(graphic);
      return result.feature.attributes;
    }); 

    //Create data object to be used in store
    var data = {
      identifier: "Parcel Identification Number",  //This field needs to have unique values. USES THE ALIAS!!!
      label: "PARCELID", //Name field for display. Not pertinent to a grid but may be used elsewhere.
      items: items
    };

     //Create data store and bind to grid.
    store = new dojo.data.ItemFileReadStore({ data:data });
    var grid = dijit.byId('grid');
    grid.setStore(store);

    //Zoom back to the initial map extent
    map.setExtent(searchExtent);

  }

  //Zoom to the parcel when the user clicks a row
  function onRowClickHandler(evt){
    var clickedTaxLotId = grid.getItem(evt.rowIndex).PARCELID;
    var selectedTaxLot;

    dojo.forEach(map.graphics.graphics,function(graphic){
      if((graphic.attributes) && graphic.attributes.PARCELID === clickedTaxLotId){
        selectedTaxLot = graphic;
        return;
      }
    });
    var taxLotExtent = selectedTaxLot.geometry.getExtent();
    map.setExtent(taxLotExtent);
  } 

and my HTML is:

<div id ="datagrid" data-dojo-type="dijit.layout.AccordionPane" splitter="true" region="bottom"
        style="width:100%; height:125px;">
        <table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid"  id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'20px'">
  <thead>
    <tr>
      <th field="Parcel Identification Number" width="10%">
                        Parcel ID
                    </th>
                    <th field="Assessing Neighbornood Code" width ="20%">
                        Neighborhood Code
                    </th>
                    <th field="Property Class Code" width="10%">
                        Property Class
                    </th>
                    <th field="Site Address" width="100%">
                        Address
                    </th>
    </tr>
  </thead>
</table>
    </div>

This is my best guess at what to add:

                <tr>
                <td align="right">
                    <div class="divOk" onclick="dijit.byId('tocDiv').hide();">
                        OK</div>
                </td>
            </tr>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:09:17+00:00Added an answer on June 16, 2026 at 6:09 pm

    I wound up creating a work around for what I want by creating a new column and putting a close icon within the header. I connected it to an function so that when I click it, the grid closes and the map resizes:

    function closeGrid() {
            esri.hide(datagrid);
            dojo.style("map", {"height": "100%"});
            }
    

    HTML

    <th field="" width="2%"> <div class="GridCloseIcon" title="Close Grid" onclick="closeGrid();"></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid that is dynamically generated based on search criteria. I render
Let's say I have some grid that looks like this _ _ _ _
I have a grid that I'm trying to populate from an XmlStore, which is
I have a grid that is binded to a dataset that is populated from
I have a Grid View populated by an ObjectDataSource. I have search box that
I have a Window with a Grid that is making a select from MySQL,
In my application I have a datagrid that populates with info from a SQLserver
I have a grid that fills select lists from a dataurl in the jqGrid
I have a tab panel that gets populated with a grid when a button
I have a grid that has multiple rows. I want to hide/show one of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.