Solved! Go to Solution.
Have you considered adding the Tabs on the fly once you get your reslutls? For example, you can loop through the results array and add a tab for each feature class results. Otherwise, you will need to get the dojo dijit tab container and remove the child tabcontainer or figure out what the hide property is for the tab container tabs. This is just a suggestion, there are of course many different ways to do this. Good luck//quick example on how to create a simple tab container (non AMD) //this code would be within your loop of results //you would generate the content on the fly and get the layername from the results for each ... var tab1 = new dijit.layout.ContentPane({ title: "myTabTitle1", selected: true, content: "point to the content the create on the fly here for 1st identify results" }); dijit.byId("myTabcontainer").addChild(tab1);
//quick example on how to create a simple tab container (non AMD) //this code would be within your loop of results //you would generate the content on the fly and get the layername from the results for each ... var tab1 = new dijit.layout.ContentPane({ title: "myTabTitle1", selected: true, content: "point to the content the create on the fly here for 1st identify results" }); dijit.byId("myTabcontainer").addChild(tab1);
Have you considered adding the Tabs on the fly once you get your reslutls? For example, you can loop through the results array and add a tab for each feature class results. Otherwise, you will need to get the dojo dijit tab container and remove the child tabcontainer or figure out what the hide property is for the tab container tabs. This is just a suggestion, there are of course many different ways to do this. Good luck//quick example on how to create a simple tab container (non AMD) //this code would be within your loop of results //you would generate the content on the fly and get the layername from the results for each ... var tab1 = new dijit.layout.ContentPane({ title: "myTabTitle1", selected: true, content: "point to the content the create on the fly here for 1st identify results" }); dijit.byId("myTabcontainer").addChild(tab1);
if(layerName === "landsResults"){
if(layerResults.features.length > 0){
content = "<i>Conservation Lands returned: " + layerResults.features.length +
"</i>";
content += .....
.....
}else{
dijit.byId("tc").removeChild(landsTab);
}
dijit.byId('MyTabContainer').removeChild(dijit.byId('MyTab'));
if (tabControl.hasChildren()) { var tabControlChildren = tabControl.getChildren(); //loop through tabcontrol and remove all children... } //call code to add all tabs based on the unique list of IdentifyResult.LayerName.
[ { "title":"Sites", "columns":{"SLOT_TYPE_CD":"Slot Type Code","USER_REF_ID":"Site Id"}, "features":[ {"SLOT_TYPE_CD":"XX","USER_REF_ID":"P123456-A"}, {"SLOT_TYPE_CD":"YY","USER_REF_ID":"P123456-B"} ] }, { "title":"Properties", "columns":{"PLAN":"Plan No.","LOCALITY":"Suburb","LOT":"Lot No."}, "features":[ {"PLAN":"RP12345","LOCALITY":"Somewhereville","LOT":"1"}, {"PLAN":"RP54321","LOCALITY":"Somewhereville","LOT":"2"} ] } ]
function displayIdentify(evt) { // destroy any existing/leftover identify dijit if (dijit.byId("identifyResults")) { dijit.byId("identifyResults").destroy(); } // create the tab container var tc = new dijit.layout.TabContainer({ id: "identifyResults", style: "height: 300px; width: 100%;" }, dojo.create("div")); // for each record in the resultset, create a dgrid and add it to the tabcontainer for (var i = 0; i < resultSet.length; i++) { var featureType = resultSet; var columns = featureType.columns; var data = featureType.features; var grid = new dgrid.Grid({ columns: columns }, dojo.create("div")); grid.renderArray(data); tc.addChild(new dijit.layout.ContentPane({ title: featureType.title, style: "height: 100%; width: 100%", content: grid.domNode })); } map.infoWindow.setTitle("Identify results"); map.infoWindow.setContent(tc.domNode); map.infoWindow.show(evt.mapPoint); dijit.byId("identifyResults").resize(); hideLoading(); }