Select to view content in your preferred language

find results into popup

403
1
04-02-2012 12:56 PM
danbecker
Frequent Contributor
Anyone have an example of putting find results into a popup window?

I can put them into a stationary data grid, no problem, just can't figure out how to wire up the results to a popup.

thanks!
0 Kudos
1 Reply
danbecker
Frequent Contributor
decided to just put find results into tab of left content pane, but need a little help getting the dojox.grid.DataGrid to display inside dijit.layout.tabcontainer

<div id="leftPane" dojotype="dijit.layout.ContentPane" region="left">
         <div dojotype="dijit.layout.TabContainer" >
             <div dojoType="dijit.layout.ContentPane" title="Legend" selected="true">
                 <div id="legendDiv"></div>
                </div>
             <div id="searchCol" dojoType="dijit.layout.ContentPane" title="Find Results">      
              <table dojoType="dojox.grid.DataGrid" jsid="grid1" id="grid1" class="searchResultsGrid"
                  rowsPerPage="10" rowSelector="20px" style="visibility:hidden;">
                  <thead>
                  <tr >
                      <th width="100px" field="site_code">FacID</th>
                      <th width="185px" field="facil_name">Fac Name</th>
                  </tr>
                  </thead>
             </table>
              <table dojoType="dojox.grid.DataGrid" jsid="grid2" id="grid2" class="searchResultsGrid"
                  rowsPerPage="10" rowSelector="20px" style="visibility:hidden;">
                  <thead>
                  <tr >
                      <th width="100px" field="site_code">FacID</th>
                      <th width="185px" field="facil_name">Fac Name</th>
                  </tr>
                  </thead>
             </table>
                </div>        
            </div>
        </div>



This is working (TabContainer removed):
 <div id="searchCol" dojotype="dijit.layout.ContentPane" region="left">
            
              <table dojoType="dojox.grid.DataGrid" jsid="grid1" id="grid1" class="searchResultsGrid"
                  rowsPerPage="10" rowSelector="20px" style="visibility:hidden;">
                  <thead>
                  <tr >
                      <th width="100px" field="site_code">FacID</th>
                      <th width="185px" field="facil_name">Fac Name</th>
                  </tr>
                  </thead>
             </table>
              <table dojoType="dojox.grid.DataGrid" jsid="grid2" id="grid2" class="searchResultsGrid"
                  rowsPerPage="10" rowSelector="20px" style="visibility:hidden;">
                  <thead>
                  <tr >
                      <th width="100px" field="site_code">FacID</th>
                      <th width="185px" field="facil_name">Fac Name</th>
                  </tr>
                  </thead>
             </table>
                </div>


pertinent js
function searchMap(){
     var searchBox = dojo.byId("txtSearch");
     var searchText = searchBox.value;
     searchText = searchText.replace(/-/g,"");
     findParams.searchText = searchText;
     searchBox.value = searchText;
     if (searchText != "") {
        featureID = "";
        startStatusUpdate(1000);
        findTask.execute(findParams, showResults);
      }
   }
  
 
   function showResults(results){
     hidePopup();
     searchResults = results;
     featureSet = null;

     var items = []; //all items to be stored in data store
     clearStatusUpdate();
     
     for (var i = 0; i < results.length; i++) {
       items.push(results.feature.attributes); //append each attribute list as item in store
     }
     setSearchResultItems2(items);
  }
 
 function setSearchResultItems2(items){
     var data = {
        identifier: keyFieldAlias, //This field needs to have unique values
        label: addressFieldAlias, //Name field for display. Not pertinent to a grid but may be used elsewhere.
        items: items
      };
  
     dojo.byId("grid1").style.visibility = "hidden";
     dojo.byId("grid1").style.display = "none";
     dojo.byId("grid2").style.visibility = "visible";
     dojo.byId("grid2").style.display = "block";
     
       //Create data store and bind to grid.
     store = new dojo.data.ItemFileReadStore({
        data: data
      });
 grid2 = dijit.byId("grid2");
     grid2.setStore(store);
     grid1HasResults = false;
     grid2HasResults = true;
   }
0 Kudos