Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

hide unhide a view in a viewstack

hi guys

I have a viewstack like this

<mx:ViewStack id="workflowViewStack" width="100%" borderColor="#000000" cornerRadius="4" selectedIndex="{modelviewdata.workflowviewstate}">              
<projectNavigation:ProjectProfileView label="Project Profile view" />            
<workflowNavigation:WorkflowView label="modelviewdata.id}" height="3000" width="3000" />
</mx:ViewStack>      


I want to hide and unhide this <workflowNavigation:WorkflowView> view. any idea how i can do it?

Something like

<mx:ViewStack id="workflowViewStack" width="100%" borderColor="#000000" cornerRadius="4" selectedIndex="{modelviewdata.workflowviewstate}">              
<projectNavigation:ProjectProfileView label="Project Profile" />      

if modelviewdata.showworkflowNavigation == "true" show it , else hide it            
<workflowNavigation:WorkflowView label="modelviewdata.selectedWorkflowid}" height="3000" width="3000" />      
</mx:ViewStack>      

thanks
Avatar of dgofman
dgofman
Flag of United States of America image

The first, if you are using ViewStack you don't need to set children containers size its will takes full area of ViewStack. To easy handle you problem create a third container (dummy) and change index to that container :)

<mx:ViewStack id="workflowViewStack" width="100%" borderColor="#000000" cornerRadius="4"
                          selectedIndex="{modelviewdata.showworkflowNavigation == true ? modelviewdata.workflowviewstate : 2}">
            <projectNavigation:ProjectProfileView label="Project Profile view" height="100%" width="100%"/>
            <workflowNavigation:WorkflowView label="modelviewdata.id}" height="100%" width="100%" />
            <mx:Canvas height="100%" width="100%"/>
      </mx:ViewStack>
Avatar of Jay Roy

ASKER

<mx:ViewStack id="workflowViewStack" width="100%" borderColor="#000000" cornerRadius="4"
 selectedIndex="{modelviewdata.showworkflowNavigation == true ? modelviewdata.workflowviewstate : 2}">
 <projectNavigation:ProjectProfileView label="Project Profile view" height="100%" width="100%"/>
  <workflowNavigation:WorkflowView label="{modelviewdata.id}" height="100%" width="100%" />
   <mx:Canvas height="100%" width="100%"/>
  </mx:ViewStack>


actually i have to display two labels
label="Project Profile view"   is always displayed no matter what

only the view <workflowNavigation:WorkflowView> and its label {modelviewdata.id} needs to be conditionally displayed if modelviewdata.showworkflowNavigation == true
so i think your code is not good for my scenario.

is there any way we can explicitly say something like

if (modelviewdata.showworkflowNavigation == "true") {
<workflowNavigation:WorkflowView label="modelviewdata.selectedWorkflowid}" height="3000" width="3000" />      
}
else{
hide
}
</mx:ViewStack>    

thx
ViewStack is not displaying labels, you have to use TabNavigator component
If you would like to hide you can use includeInLayout and visibile false attribute
Avatar of Jay Roy

ASKER

ok...got it , one final question

I have
<workflowNavigation:WorkflowView  label="{modeldata.doesflowExist ==  false ? 'Create New Flow' : modeldata.showWorkFlow == false ? ' ' : modelviewdata.selectedWorkflowid}" height="3000" width="3000"  />      

 if modeldata.showWorkFlow  is false I want to avoid ' '  in above statement which is  causing a blank space in my view. i tried
<workflowNavigation:WorkflowView  label="{modeldata.doesflowExist ==  false ? 'Create New Flow' :modeldata.showWorkFlow == true ? modelviewdata.selectedWorkflowid}"height="3000" width="3000"  />

but i end up getting a error :expecting colon before right paren.

any idea how i can fix this?

thanks v much.

ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial