Populate Flex Grids during view state?

Hi, I am very new to Flex. I am working on a Flex project where I want to populate xml data in the two grids during viewstate. In my project, I have two grid which resides in the two discinct view state named as "Category" and "Topic". For these two view state, i have two disctinct grids.
I am successfully able to populate one grid that is "Category" state grid but when i change the state on button click event another grid does not populate with the data.
Can anyone help me with this?
Please have a look on the code below for better idea:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="730" height="492" creationComplete="TopCategoryTopic()" currentState="HotCategory">
<mx:states>
  <mx:State name="HotTopic">
      <mx:SetEventHandler target="{btnHotTopics}" name="click" handlerFunction="TopCategoryTopic">     
      </mx:SetEventHandler>
  <mx:SetProperty target="{btnHotTopics}" name="label" value="Top &quot;Hot&quot; Topic"/>
  <mx:RemoveChild target="{categoryGrid}"/>
  <mx:AddChild relativeTo="{canvas1}" position="lastChild">
    <mx:DataGrid id="topicGrid" x="10" y="27" width="601" height="263" color="#000000">   
    </mx:DataGrid>
  </mx:AddChild>
  <mx:AddChild relativeTo="{canvas1}" position="lastChild">
    <mx:Label x="10" y="10" text="Top &quot;Hot&quot; Topic" width="150" color="#000000" fontWeight="bold" fontFamily="Verdana" fontSize="11" id="label0"/>
  </mx:AddChild>
  </mx:State>
  <mx:State name="HotCategory">
    <mx:SetEventHandler target="{btnHotCategories}" name="click" handlerFunction="TopCategoryTopic">     
      </mx:SetEventHandler>
      <mx:SetProperty target="{btnHotCategories}" name="label" value="Top &quot;Hot&quot; Categories"/>
  <mx:RemoveChild target="{categoryGrid}"/>
  <mx:AddChild relativeTo="{canvas1}" position="lastChild">
    <mx:DataGrid id="categoryGrid"  x="10" y="27" width="601" height="263" color="#000000">   
    </mx:DataGrid>
  </mx:AddChild>
  <mx:AddChild relativeTo="{canvas1}" position="lastChild">
    <mx:Label x="10" y="10" text="Top &quot;Hot&quot; Category" width="159" color="#000000" fontWeight="bold" fontFamily="Verdana" fontSize="11" id="label2"/>
  </mx:AddChild>
  </mx:State>
</mx:states>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
  width="730" height="492" headerHeight="20"
      showCloseButton="true" borderColor="#000000"
  layout="absolute" fontSize="12" verticalScrollPolicy="off"
  horizontalScrollPolicy="off" title="Customer Success &amp; Strategy - Q4 Hot Topics/Categories"
  themeColor="#0E4463" horizontalCenter="0"
  verticalCenter="0" id="CSSTopPresenter" cornerRadius="0" alpha="1.0"
  backgroundColor="#FFFFFF" borderThickness="0" close="CloseWindow()"
  color="#FFFFFF" borderThicknessLeft="3" borderThicknessRight="3" borderThicknessBottom="3">
    <mx:Script>
        <![CDATA[
            import mx.controls.dataGridClasses.DataGridColumn;
      import mx.collections.XMLListCollection;
        import mx.managers.PopUpManager;
            import mx.rpc.events.FaultEvent;
  import mx.rpc.events.ResultEvent;
  import mx.rpc.http.HTTPService;
  import mx.events.FlexEvent;
  import mx.controls.Alert;
  import flash.events.MouseEvent;
            [Bindable]
            private var _xmlData:XMLList;
            private function TopCategoryTopic():void
                var httpService:HTTPService = new HTTPService();
            httpService.url = "http://ri/co.UI/CtSS/Rsources/Hgory.aspx?Month=January&Year=2009";
            httpService.resultFormat = "e4x";
    httpService.addEventListener(ResultEvent.RESULT, onResultHttpService);
    httpService.send();
            //funtion to receive Http Service Response as XML Document         
          private function onResultHttpService(e:ResultEvent):void
    //var xmlData:XMLList = e.result.CategoryTopic;
    var category:XMLList = e.result.categories;
    var topic:XMLList= e.result.topics;
    if(currentState=="HotCategory")
        categoryGrid.dataProvider = category;
        for each (var node:XML in category[0].children())
            addDataGridColumn1(node.name());
    else if(currentState=="HotTopic")
      topicGrid.dataProvider = topic;
      for each (var node1:XML in topic[0].children())
        addDataGridColumn2(node1.name());
    //function to add Categories column dynamically
  private function addDataGridColumn1(dataField:String):void
    var dgc:DataGridColumn=new DataGridColumn(dataField);
    var cols:Array=categoryGrid.columns;
    cols.push(dgc);
    categoryGrid.columns=cols;
    categoryGrid.validateNow(); 
            //function to add Topic column dynamically
  private function addDataGridColumn2(dataField:String):void
    var dgc:DataGridColumn=new DataGridColumn(dataField);
    var cols:Array=topicGrid.columns;
    cols.push(dgc);
    topicGrid.columns=cols;
    topicGrid.validateNow(); 
      //funtion to remove grid window
  private function CloseWindow():void
    PopUpManager.removePopUp(this);
    ]]>
    </mx:Script>
    <mx:Button id="btnHotCategories" label="Top &quot;Hot&quot; Categories" width="173" height="37" borderColor="#2673A9" cornerRadius="6" labelPlacement="left" color="#000000" click="currentState='HotCategory'" x="45" y="23" fillAlphas="[1.0, 1.0]" fillColors="[#4D8F8D, #CCD3DE]"/>
    <mx:Button id="btnHotTopics" label="Top &quot;Hot&quot; Topic"  width="172" height="38" cornerRadius="6" borderColor="#000000"  color="#000000" click="currentState='HotTopic'"  x="46" y="78" fillAlphas="[1.0, 1.0]" fillColors="[#4D8F8D, #CCD3DE]"/>
    <mx:Canvas width="621" height="302" borderStyle="solid" borderColor="#0092F9" y="155" x="46" cornerRadius="9"  alpha="0.61" backgroundColor="#0092f9" id="canvas1">
    </mx:Canvas> 
    <mx:Image x="294" y="0" width="373" height="147" source="assets/CategoryTopic.gif"/>
</mx:TitleWindow>
</mx:Canvas>
Thanks in advance.
Vivek Jain
Software Engineer

I simplified the problem to it's essence and came up with this:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal"
    creationComplete="init()">
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable]
            public var lProvider:ArrayCollection;
            private function init():void
                var la:Array = [{label: "Conference", checked: true},
                                {label: "Tickets", checked: false}];
                lProvider = new ArrayCollection(la);
        ]]>
    </mx:Script>
    <mx:List id="cList" width="200" dataProvider="{lProvider}" itemClick="lProvider.refresh()">
        <mx:itemRenderer>
            <mx:Component>
                <mx:HBox width="100%">
                    <mx:CheckBox selected="{data.checked}" click="data.checked = event.target.selected"/>
                    <mx:Label text="{data.label}"/>
                </mx:HBox>
            </mx:Component>
        </mx:itemRenderer>
    </mx:List>
    <mx:VBox width="600">
        <mx:Panel title="Conference component" width="100%" height="200"
                visible="{lProvider.getItemAt(0).checked}"
                includeInLayout="{lProvider.getItemAt(0).checked}"/>
        <mx:Panel title="Ticket component" width="100%" height="200"
                visible="{lProvider.getItemAt(1).checked}"
                includeInLayout="{lProvider.getItemAt(1).checked}"/>
    </mx:VBox>
</mx:Application>
Does this help?
Dany

Similar Messages

  • Flex 3 :Help needed in implementing View States

    Hi 
    I am new to Flex , i am trying to understand View States , tried for one hour but got confused .
    (Basically by seeing the examples i understood the concept , but failed to implement ) 
    Please help .
    Assume my requirement is at the load of the page , i want to show an Login Button and a Chnage State Button (common button) only .and when the Change State button is clicked on ,i want to show the Register Button .
    So for this i made two Forms , and a common button .
           <mx:Form id="RegForm">
                <mx:Button label="RegFormButton" id="RegFormButton"/>
            </mx:Form>
            <mx:Form id="loginForm">
                        <mx:Button label="LoginButton" id="loginButton"/>
            </mx:Form>
    <!-- A common button for both the States-->
      <mx:Button label="Change State"
                  click=""/>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" currentState="Register">
    <mx:states>
    <mx:State name="Register">         
    <mx:SetProperty   target="RegForm"   value="Register"/>
    </mx:State>
    <mx:State name="loginForm">
    <mx:SetProperty   target="loginForm"   value="Login"/>
    </mx:State>
    </mx:states>
    ( I think some how i can write the Logic to chnage to the current state to loginForm when user clicks with some inline code , but please tell me At the start of the page please tell me why I am not able to show the Register.

    sorry for posting a dumb question .
    I realized my mistake .

  • C#/SharePoint -View State related issue while exporting data to excel

    We have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
    View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
    the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
    is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
    We tried to solve this issue by creating a compressor class and overriding two methods:
     LoadPageStateFromPersistenceMedium
    SavePageStateToPersistenceMedium
    This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
    page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
    Please suggest how to resolve this issue or any workaround for this

    We have web application based on SharePoint. We have a list view to display data based on Search Criteria. We have total of around 16000 data. When we try to export all data to excel it gives an error. The cause of the issue is:
    View State is used to save the state of page i.e. the previous state. When the export to excel link is clicked, the data present in the grid is actually saved in view state so that the overhead of again generating
    the data(as per the selection criteria) can be avoided. Now, this View state has a limitation of storage of these records. When we put in some selection criteria, the no. of records is less hence no problem in actually storing the view state. But when there
    is no selection criteria, 16306 records are too much to be stored in view state. Hence the error occurs.
    We tried to solve this issue by creating a compressor class and overriding two methods:
     LoadPageStateFromPersistenceMedium
    SavePageStateToPersistenceMedium
    This has resolved the issue with Export to Excel. However, there is now some issue in the paging of the list view. The list view has a column with hyperlink which opens related data in a form. While we click on the link in 2<sup>nd</sup>
    page of the list view, it displays data for the link in the 1<sup>st</sup> page at same row.
    Please suggest how to resolve this issue or any workaround for this

  • Change base view state from a custom component

    I'm pretty new to flex and I'm having a small issue in change the view state from a component.
    My Application have 2 custom components called userlogin and main menu. In the main application page I have userlogin component in one state and the main menu component in another. I'm trying to change the state if the login in successful from user login to main menu. I have the following function written inside the login component.
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    This code worked when I had all the controls in the main page. But then I created components and included them in to components and now when the login is success, its giving the following error.
    ArgumentError: Undefined state 'MainMenu'.
        at mx.core::UIComponent/getState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UI Component.as:9908]
        at mx.core::UIComponent/findCommonBaseState()[E:\dev\4.0.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9928]
        at mx.core::UIComponent/commitCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\ mx\core\UIComponent.as:9750]
        at mx.core::UIComponent/setCurrentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\ core\UIComponent.as:9701]
        at mx.core::UIComponent/set currentState()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6087 ]
        at components::UserLoginForm/__btnSubmit_click()[C:\Projects\WarrantyAutomation\src\componen ts\UserLoginForm.mxml:60]
    I'm sure this has something to do with accessing the states from a custom component, but I do not know how to change the state to the main menu. Please help me with this. Any help is greatly appriciated.

    Hi dasun1981,
    private function IsUserLoggedIn(evt:ResultEvent):void
                    if (evt.result.islogin.toString() == "true")
                        currentState = "MainMenu";
                    else
                        Alert.show("Login failed, please try again.", "Login Failed");
    If I am right the above function is in your userlogin component and the two components "userlogincomponent" and "maincomponent" are in main application file and the states were also defined in main application file.
    But in the function above the currentState refers to the state of the userlogin component and not the main application ...but the states are defined in main application file...that's the reason why the exception was thrown...
    Instead you replace the line in the above function with the below line:
    Application.application.currentState = "MainMenu";
    Please mark it as answer if it helped you.
    Thanks,
    Bhasker Chari

  • Change View State Based On Screen Orientation?

    I'd like my app to change layouts based on the current screen orientation.  I believe this is done through view states.  I have three questions...
    1) How do I check the current orientation?
    2) Is there an event listener that will tell me when the orientation changes?
    3) How do I toggle between view states?
    Thank in advance!
    UPDATE: I figured out the answer to question 3...
    currentState = 'yourStateName';
    UPDATE II: I figured out the answer to question 1 as well.  I simply used the Capabilities object to determine the screens current width & height, then compare the two.  All of this is in a function that gets called when the app launches:
    public function checkOrientation():void
         var screenWidth:Number = Capabilities.screenResolutionX;
         var screenHeight:Number = Capabilities.screenResolutionY;
         if (screenWidth > screenHeight) {currentState='yourStateName1';}
         else if (screenWidth < screenHeight) {currentState='yourStateName2';}
    Now all I have to do is figure out how to call this function when there is an orientation change.  I tried the code below but get the included error:
    stage.addEventListener(Event.RESIZE, checkOrientation); // ERROR: Access of undefined property stage
    Why can't access the "stage" property???

    Hi,
    I work on platform using flash bulider 4, later i finsh the platform but i meeting one problem is resize project to work with diffrent size screen, but i can't solve the problem, i need platform work with diffrent Screen Orientation without problem could some help  please, this that what i done in code please help.
    Thanks,
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:rtc="http://ns.adobe.com/rtc" width="100%" height="100%" backgroundColor="#51575D">
           <fx:Style source="Client.css"/>
             <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import flash.events.FullScreenEvent;
                protected function txtUsername_enterHandler(event:FlexEvent):void
                    // TODO Auto-generated method stub
                    connectRoom.login();
                    labelUsername.visible = false;
                    txtUsername.visible = false;
                function fullScreenRedraw(event:FullScreenEvent):void
                    if (event.fullScreen)
                        width  = Capabilities.screenResolutionX;
                        height = Capabilities.screenResolutionY;
                    else
                        width = stage.stageWidth;
                        height = stage.stageHeight;
            ]]>
        </fx:Script>
           <fx:Declarations>
             <s:Move duration="500" id="moveEffect"/>
            <s:Resize duration="500" id="resizeEffect"/>
        </fx:Declarations>
                  <mx:Image x="0" y="0" width="100%"  height="100%" scaleContent="false" autoLoad="true" source="greenbackground.png"/>
                                     <rtc:ConnectSessionContainer horizontalScrollPolicy="off" verticalScrollPolicy="off" id="connectRoom" autoLogin="false"
                                           roomURL="https://collaboration.adobelivecycle.com/account/yourroom"
                                           y="20" width="95%" height="90%" backgroundColor="#212D4B" contentBackgroundColor="#F6F6F0" borderAlpha="1.0" cornerRadius="30" contentBackgroundAlpha="1.0" backgroundAlpha="0.4" x="33" dropShadowVisible="true" borderVisible="true">
                        <rtc:authenticator>
                                <rtc:AdobeHSAuthenticator userName="{txtUsername.text}"/>
                     </rtc:authenticator>
                          <rtc:SimpleChat width="293" height="258" x="2" y="165" chromeColor="#384D91"/>
                           <rtc:WebcamSubscriber y="4" displayUserBars="true"  width="292" height="158" x="2"/>
                     <rtc:AudioSubscriber id="audioSub" width="0" height="0"/>
                                         <rtc:FileShare height="135" width="290" x="5" y="425" chromeColor="#284C79"/>
                        <rtc:ScreenShareSubscriber id="scrShare" width="81%" height="99%" y="4" x="299"/>
        </rtc:ConnectSessionContainer>
        <s:Label id="labelUsername" y="230" text="   Enter a username and press Enter:&#xd;" color="#B5C40D" fontWeight="bold" horizontalCenter="0"/>
        <s:TextInput y="250" width="229" textAlign="center" id="txtUsername" enter="txtUsername_enterHandler(event)" color="#090909"
    horizontalCenter="0" height="27" fontWeight="bold" borderAlpha="0.99" contentBackgroundColor="#989A9C"/>
    </s:Application>

  • Controlling view states

    It would be nice to get feedback from a more experienced
    developer about how I should implement my view with regards to
    state, on the one hand I have a book (essential flex 2.0 with
    actionscript 3.0) which explains that view state should be handled
    using <mx:state> and on the other hand I have the cairngorm
    examples (cairngorm store and cairngorm login) that use a
    viewstack.
    I don't think I fully comprehend what the implications of
    choosing one or the other will be, other than using viewstack looks
    simpler.
    I would be grateful for any advice. Thankyou
    James

    from flexcoders on yahoo
    Here's what I'm getting from all the manual reading I've been
    doing over the past week. Others may correct me or clarify as
    needed.
    - Think of the base state as the "home page"... it's the
    initial state of the app or component when the user browses to it.
    I can't think of a good reason why it would ever be empty unless
    you wanted to implement some kind of transition or effect
    immediately upon loading it.
    - In the larger sense of UI design, HTML "pages" are
    addressed in the Flex metaphor with ViewStacks attached to a
    navigator. Use this for macro changes in the interface.
    - View states are used to display incremental changes in
    state. Sounds like you are using that correctly insofar as you
    describe it... however, depending on how your user interface is
    designed and what you're trying to accomplish, the "Detail" state
    you describe could also be just an incremental change to the
    "Master" state with the Master state remaining visible. Also, the
    "Master" state could be your base state since it's empty and that's
    the first thing the user sees.

  • Multiple view state best practice for IOS packaged app - Tabbed view or blank template?

    TabbedViewNavigatorApplication or plain Application?
    I have an iPad app that has a fairly complex main view.  Has lots of view state changes.  Before a user can get to that main view, however, they have to go through two other screens:
    1.  Authentication
    2.  Fill out and submit a small form (maybe 6 fields)
    If they do those two things right, they can move on to the main view.  If they don't, they can't move on and the main view shouldn't load.
    Don't want a tab bar showing in the main view.  Has to be full screen.
    My thoughts were:
    1.  Start with the tabbed view template because it's built for this.  Just figure out a way to hide bars top and bottom for main view.
    2.  Use a blank template and do everything with standarf Flex view states
    Not sure...

    Or you can go with door #3, a blank template with a ViewNavigator you use to push and pop your views from the Main.
    View states are heavy. Avoid them like the plague in mobile apps. They are ok for small things like buttons and such, but that's about it.

  • Flex Grid Issues

    Hi,
    I am using Flex Grid in my project where i am successfully able to populate xml data dynamically. what i am doing here, I am dynamically generating the xml using httpservice. This HttpService is returning an XmlList that i am using to bind the grid dynamically.
    Here i am not fixing the column header text and column width as  in future the number of cloumns can be increased so i can't fix the column header text and column width.
    Here the issue is: how to remove " _x0020_"  from the header text and how to fix column width dynamically using Action Script.
    For better idea please refer the screen shot as attached along with post.
    Please have a look on the code as pasted below:
    <?xml version="1.0" encoding="utf-8"?><mx:Canvas 
    xmlns:mx="http://www.adobe.com/2006/mxml" width="862" height="580"><mx:TitleWindow 
    x="182" y="113" width="670" height="395" layout="vertical" title="
    Top Presenters" fontSize="12"horizontalAlign="
    center" verticalAlign="top" showCloseButton="true" close="CloseGridWindow()" verticalScrollPolicy="
    off" borderColor="#000000"horizontalScrollPolicy="
    off" borderThicknessLeft="3"borderThicknessRight="
    3" borderThicknessBottom="3" creationComplete="GetTopPresentersXMLData()" backgroundColor="
    #FFFFFF" cornerRadius="
    0" color="#FFFFFF" >
    <mx:Script><![CDATA[
    import mx.controls.dataGridClasses.DataGridColumn; 
    import mx.collections.XMLListCollection; 
    import mx.managers.PopUpManager; 
    import mx.rpc.events.FaultEvent; 
    import mx.rpc.events.ResultEvent; 
    import mx.rpc.http.HTTPService; 
    import mx.events.FlexEvent; 
    import mx.controls.Alert; 
    //funtion to get Top Presenters xml data 
    private function GetTopPresentersXMLData():void{
    var httpService:HTTPService = new HTTPService();httpService.url =
    "http://ri/CItSL/Ters.aspx?mode=all&month=march&year=2009";httpService.resultFormat =
    "e4x";httpService.addEventListener(ResultEvent.RESULT, onResultHttpService);
    httpService.send();
    Bindable] 
    private var _xmlData:XMLList; 
    //funtion to receive Http Service Response as XML Document  
    private function onResultHttpService(e:ResultEvent):void{
    var xmlData:XMLList = e.result.Table;myGrid.dataProvider = xmlData;
    for each (var node:XML in xmlData[0].children()){
    addDataGridColumn(node.name());
    //function to add column dynamically  
    private function addDataGridColumn(dataField:String):void{
    //var spacePattern:RegExp=/_x0020_/g; 
    //var andPattern:RegExp=/_x0026_/g; 
    //dataField=dataField.replace(spacePattern," "); 
    //dataField=dataField.replace(andPattern,"&"); 
    var dgc:DataGridColumn=new DataGridColumn(dataField); 
    var cols:Array=myGrid.columns;cols.push(dgc);
    myGrid.columns=cols;
    myGrid.validateNow();
    //funtion to remove grid window 
    private function CloseGridWindow():void{
    PopUpManager.removePopUp(
    this);}
    ]]>
    </mx:Script>  
    <mx:DataGrid id="myGrid" alternatingItemColors="[#A2F4EF, #EFDE7D]" x="0" y="0" sortableColumns="false" width="658" height="352" fontSize="10" verticalAlign="middle" editable="false" enabled="true" horizontalGridLineColor="#befcc4" color="#000000">  
    </mx:DataGrid>
    </mx:TitleWindow>
    Please let me know, If anyone knows the solution.

    Hi,
    You can follow the below mentioned code and see if this works for you.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
        creationComplete="onComplete();">
        <mx:Script>
            <![CDATA[
                // imports:
                import mx.events.FlexEvent;
                import mx.core.UIComponent;
                import mx.controls.dataGridClasses.DataGridColumn;
                import mx.controls.Text;
                import mx.utils.ObjectUtil;
                import mx.controls.Label;
                import mx.collections.ArrayCollection;
                // data provider:
                [Bindable] private var dp:ArrayCollection = new ArrayCollection();
                private function onComplete():void {
                    // populate data provider here
                    // to avoid calcMaxLengths execution when the app is created:
                    dp = new ArrayCollection(
                            { col1: "Short", col2: "Other column 1" },
                            { col1: "Some long string", col2: "Other column 2" },
                            { col1: "Short", col2: "Other column 3" },
                            { col1: "Short", col2: "Other column 4" },
                            { col1: "The longest value in this column", col2: "Other column 5" },
                            { col1: "Short", col2: "Other column 6" },
                            { col1: "Short", col2: "Other column 7" }
                // this is going to be executed whenever the data provider changes:
                [Bindable("dataChange")]
                private function calcMaxLengths(input:ArrayCollection):ArrayCollection {
                    // if there are items in the DP:
                    if ( input.length > 0 ) {
                        // and no SPECIAL child exists:
                        if ( getChildByName("$someTempUICToRemoveAfterFinished") == null ) {
                            // create new SPECIAL child
                            // this is required to call measureText
                            // if you use custom data grid item renderer
                            // then create instance of it instead of UIComponent:
                            var uic:UIComponent = new UIComponent();
                            // do not show and do not mess with the sizes:
                            uic.includeInLayout = false;
                            uic.visible = false;
                            // name it to leverage get getChildByName method:
                            uic.name = "$someTempUICToRemoveAfterFinished";
                            // add event listener:
                            uic.addEventListener(FlexEvent.CREATION_COMPLETE, onTempUICCreated);
                            // add to parent:
                            addChild(uic);
                    // return an input:
                    return input;
                // called when SPECIAL child is created:
                private function onTempUICCreated(event:FlexEvent):void {
                    // keep the ref to the SPECIAL child:
                    var renderer:UIComponent = UIComponent(event.target);
                    // output - this will contain max size for each column:
                    var maxLengths:Object = {};
                    // temp variables:
                    var key:String = "";
                    var i:int=0;
                    // for each item in the DP:
                    for ( i=0; i<dp.length; i++ ) {
                        var o:Object = dp.getItemAt(i);
                        // for each key in the DP row:
                        for ( key in o ) {
                            // if the output doesn't have current key yet create it and set to 0:
                            if ( !maxLengths.hasOwnProperty(key) ) {
                                maxLengths[key] = 0;
                            // check if it's simple object (may cause unexpected issues for Boolean):
                            if ( ObjectUtil.isSimple(o[key]) ) {
                                // measure the text:
                                var cellMetrics:TextLineMetrics = renderer.measureText(o[key]+"");
                                // and if the width is greater than longest found up to now:
                                if ( cellMetrics.width > maxLengths[key] ) {
                                    // set it as the longest one:
                                    maxLengths[key] = cellMetrics.width;
                    // apply column sizes:
                    for ( key in maxLengths ) {
                        for ( i=0; i<dg.columnCount; i++ ) {
                            // if the column actually exists:
                            if ( DataGridColumn(dg.columns[i]).dataField == key ) {
                                // set size + some constant margin
                                DataGridColumn(dg.columns[i]).width = Number(maxLengths[key]) + 12;
                    // cleanup:
                    removeChild(getChildByName("$someTempUICToRemoveAfterFinished"));
            ]]>
        </mx:Script>
        <mx:DataGrid id="dg" horizontalScrollPolicy="on" dataProvider="{calcMaxLengths(dp)}" width="400">
            <mx:columns>
                <mx:DataGridColumn dataField="col1" width="40" />
                <mx:DataGridColumn dataField="col2" width="100" />
            </mx:columns>
        </mx:DataGrid>
    </mx:WindowedApplication>
    Regards

  • Application View States -vs- Windows

    Hello,
    I'm a new Flex user, and have just gotten started using Flex
    2. I have lots of experience developing web apps using ASP.NET. I
    have poured over all the downloadable documentation, and most of
    what I see in the docs are single window samples. I have a flex
    application to develop that will probably end up being about 25
    different screens. I am wondering what the proper way to partition
    the source code should be. Do I need to create one "MXML
    Applicaton" per screen? If so, that would result in a different SWF
    file for each screen, right? When I move from screen to screen, is
    it going to keep the same session object so I can retain the
    context of the user's actions? Or, is it the standard practice to
    try to cram all of the screens into a single MXML Application file
    as different "View States" and have the entire application load up
    when they hit the huge single SWF file?

    I have the same question !!
    I too have to develop a rather complex
    Ordering-Production-Shipping-Billing application. Many screens and
    lots of business logic.
    I will use ColdFusion for the backend and lots of data logic
    will be in the database and CFC. Flex will handle the user
    interface part.
    But I am not quite sure how to handle the windows part and
    also the "modal" aspect of the interface.
    For now my prototype uses ViewStacks and some panels uses
    states depending on customer type or product type selected. The
    user needs to be at the top most view of a main function to access
    other main functions like Production or Shipping. If a user digs
    into a main function I remove the options (using states) to jump to
    other main functions.I want them to close the transactions before
    jumping to other things in the application.
    The main MXML file contains the application bar and
    MainViewStack. Each main function is in a separate MXML file (as
    per examples in the documentation).
    The swf is likely to be large but I do not mind so much, it
    will be used on the Intranet on a 1gb network.
    Steve

  • View states for components

    Hi hoping someone could help. I understand view states and can use them. However in this situation I want to have a view state for a control bar but I already have 2 view states for another component (a panel component) in my Flex app and want to separate the control bar view state from the panel view state.
    Therefore when I set the currentState = 'showBtn' it's affecting the panel view state and I don't want it to. I've tried putting the <mx:states> tag in under the component i'm trying to add the button view state to but i'm getting an "Initializer for the property 'states' is not allowed here" error.

    i've tried that... when i start using the id of the component like myPanel.currentState = "whatever" it tells me the currentState whatever is undefined. it only seems to work if i do currenState = "whatever". here is some of my code to help you see my problem:
    <mx:Script>
    <![CDATA[ 
    private function toggleFilter():void{ 
    if (p1.currentState == 'viewRequests'){p1.currentState =
    'searchFilter';filterButton.label =
    'Hide Filter';}
    else{p1.currentState =
    'viewRequests';filterButton.label =
    'Show Filter'; 
    private function buttonBar():void{ 
    if (changeQueue.selectedItem.REQ_BY_ID == Application.application.parameters.emplid){queueControlBar.currentState =
    'showRecallBtn';}
    else{queueControlBar.currentState =
    ]]>
    </mx:Script>
    <mx:states>
    <mx:State name="viewRequests">
    <mx:AddChild relativeTo="{p1}" position="firstChild">
    <mx:HBox id="resultBox" width="100%" height="100%">
    <mx:DataGrid id="changeQueue" x="0" y="0" width="100%" height="100%" dataProvider="{SAMService.getRequests.lastResult}" change="buttonBar();">
    <mx:columns>
    <mx:DataGridColumn headerText="Change ID" dataField="CHANGE_ID" visible="false"/>
    <mx:DataGridColumn headerText="Change Type" dataField="CHANGE_TYPE"/>
    <mx:DataGridColumn headerText="Status" dataField="STATUS"/>
    <mx:DataGridColumn headerText="Request Date" dataField="REQ_DT" labelFunction="doDateLabel"/>
    <mx:DataGridColumn headerText="Requested By ID" dataField="REQ_BY_ID" />  
    </mx:columns>
    </mx:DataGrid>
    </mx:HBox>
    </mx:AddChild>  
    </mx:State>
    <mx:State name="searchFilter">
    <mx:AddChild relativeTo="{p1}" position="secondChild">
    <SearchPanel id="searchPanel" width="100%" height="100%"/>
    </mx:AddChild>
    </mx:State>
    <mx:State name="showRecallBtn">
    <mx:AddChild relativeTo="{queueControlBar}" position="lastChild">
    <mx:Button label="Recall Item" icon="@Embed(source='images/recall.gif')" enabled="{changeQueue.dataProvider.length > 0}"/>
    </mx:AddChild>
    </mx:State>
    </mx:states>
     <mx:HBox x="0" y="360" width="95%" horizontalAlign="center" paddingLeft="25" paddingRight="25">
     <mx:Panel id="p1" width="100%" height="90%" layout="absolute" title="Change Request Queue" currentState="viewRequests">
     <mx:ControlBar>
     <mx:HBox id="queueControlBar" width="100%" horizontalAlign="center" currentState="">
     <mx:Button label="Details" icon="{detailsIcon}" enabled="{changeQueue.selectedIndex>-1}" click="WindowManager.add(getDetails(), this, true);"/>
     <mx:Button id="filterButton" label="Show Filter" icon="@Embed(source='images/search.png')" click="toggleFilter();"/>
     <mx:Button id="OICbutton" label="Export OIC Changes" icon="@Embed(source='images/export.png')" enabled="{changeQueue.dataProvider.length > 0}" click="oicChanges();"/>
     </mx:HBox>
     </mx:ControlBar>
     </mx:Panel>
     </mx:HBox>

  • Locale Input changes on Mac OS X Lion when changing the view state

    On Mac OS X Lion, the following code results of changing the locale input when changing the view state. If you set the input locale to Pynin, then run the application, then click on "go to the test 2", the input locale changes back to english. This is obviously not the correct behavior (the input locale should stay the same as defined on the computer).
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx">   
        <fx:Script>
            <![CDATA[
                protected function gototest2(event:MouseEvent):void
                    this.currentState = "test2";
                protected function gototest(event:MouseEvent):void
                    this.currentState = "test";
            ]]>
        </fx:Script>
        <s:states>
            <s:State name="test" />
            <s:State name="test2" />
        </s:states>
        <s:Button label="go to test" includeIn="test2" click="gototest(event)" />
        <s:Button label="go to test2" includeIn="test" click="gototest2(event)" />
        <s:TextInput includeIn="test2" />
    </s:WindowedApplication>

    Could you please open a new bug report on this over at bugbase.adobe.com?  Please post back with the URL so that others affected can add their comments and votes.

  • Shoudn't Managed Bean be part of view state?

    Hello,
    Why does JSF not identify managed bean as part of view state? After all it is beans which provide the data (model) for components in view. Isn't data part of view state?
    There are number of problems with 'request' scoped beans - in fact there are enough reasons to question why JSF allowed 'request' scope in first place.
    1. Choice of request scope saves storage, but requires the developers to save the bean data in session and restore that data everytime when the bean is reconstructed on subsequent POST backs.
    2. Failure to store or restore the bean's previous data results in NullPointerExceptions during APPLY_REQUEST_VALUES phase, when JSF tries to compare old values with new submitted values to broadcast events.
    3. This essentially mean beans are required (with old data) right at the APPLY_REQUEST_VALUES phase, same as the view state.
    4. Any storing of data in session creates overhead of cleaning it without fail. Failure to clean results in too big session storage affecting performance.
    5. Restoring bean state sometimes also means database calls as early as APPLY_REQUEST_VALUES phase - which is not the right phase for such business logic.
    JSF spec should at least provide a way for developers to configure the bean to be saved in view state.

    Hello,
    Why does JSF not identify managed bean as part of
    view state? After all it is beans which provide the
    data (model) for components in view. Isn't data part
    of view state?No. MVC is about seperating M-V-C. Model - View - Controller. View == page, Model == data. Data can be very large in some cases, storing it with a page (per user) is not scalable and is not a good idea in many cases.
    There are number of problems with 'request' scoped
    beans - in fact there are enough reasons to question
    why JSF allowed 'request' scope in first place. Request scope is very useful for certain things. I think a "pageScope" is missing, which is why I added it to JSFTemplating (https://jsftemplating.dev.java.net). Request scope is not appropriate for all cases.
    1. Choice of request scope saves storage, but
    requires the developers to save the bean data in
    session and restore that data everytime when the bean
    is reconstructed on subsequent POST backs.
    2. Failure to store or restore the bean's previous
    data results in NullPointerExceptions during
    APPLY_REQUEST_VALUES phase, when JSF tries to compare
    old values with new submitted values to broadcast
    events.
    3. This essentially mean beans are required (with old
    data) right at the APPLY_REQUEST_VALUES phase, same
    as the view state.Both managed beans and the request scope map itself can make this happen transparently.
    4. Any storing of data in session creates overhead of
    cleaning it without fail. Failure to clean results in
    too big session storage affecting performance.I agree.
    5. Restoring bean state sometimes also means database
    calls as early as APPLY_REQUEST_VALUES phase - which
    is not the right phase for such business logic.Depends on how you write your beans / application.
    JSF spec should at least provide a way for developers
    to configure the bean to be saved in view state.You don't have to use beans let alone use "managed" beans. If you feel your application would be better off storing data w/ the view state... get the UIViewRoot, call setAttribute("key", yourData).
    Good luck!
    Ken Paulsen
    https://jsftemplating.dev.java.net

  • How: Modules within View States?

    Hey fellow FLEXers:
    I have a main app configured with view states. Each view state should load a module. Only the first module loads, and when the second one tries to run it fails to run. Any ideas what may be causing this?
    Here is the main app code:
    And here the SignIn module:
    And here the CompanySelection module:
    And the CompanyTileList component that the CompanySelection module requires:
    Any help is greatly appreciated.
    Also, if anyone can point me in the direction of some good tutorials for using modules and views (hopefully in combination), that would be great. I purchased the book FLEX 3 in Action, but unfortunately it doesn't go into too much detail on this topic.
    Thanks!
    Mike

    The problem I am experiencing is that the TileList in the CompanySelection module is not being populated; it results in the module displaying without the tile list.
    Everytime I try to add ActionScript code in my post using the INSERT HTML functionality, it dissappears. Any ideas? I'll try adding XML.
    Main App:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application
         xmlns:mx="http://www.adobe.com/2006/mxml"
         creationComplete="app_init()"
    >
         <mx:Script>
              <![CDATA[
                   import mx.controls.Alert;
                   import mx.rpc.events.FaultEvent;
                   import com.brassworks.ValueObjects.UserVO;
                   [Bindable]
                   private var current_user:UserVO;
                   private function app_init():void
                        setState("SignIn");
                        //if ((!current_user) || (current_user.id <= 0)) {setState("SignIn");}
                   public function setState(state:String):void
                        currentState = state;
                   public function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
                   public function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
              ]]>
         </mx:Script>
         <mx:Canvas
              id="pnl_default"
         >
         </mx:Canvas>
         <mx:states>
              <mx:State
                   name="SignIn"
              >
                   <mx:RemoveChild
                        target="{pnl_default}"
                   />
                   <mx:AddChild>
                        <mx:ModuleLoader
                             id="mdl_signin"
                             url="com/brassworks/modules/admin/SignIn.swf"
                        />
                   </mx:AddChild>                    
              </mx:State>
              <mx:State
                   name="ChooseCompany"
              >
                   <mx:RemoveChild
                        target="{pnl_default}"
                   />
                   <mx:AddChild>
                        <mx:ModuleLoader
                             id="mdl_choose_company"
                             url="com/brassworks/modules/admin/CompanySelection.swf"
                        />
                   </mx:AddChild>                    
              </mx:State>
         </mx:states>
         <mx:transitions>
              <mx:Transition
                   fromState="*"
                   toState="*"
              >
                   <mx:Parallel
                        id="trn_default"
                        targets="{['SignIn', 'ChooseCompany']}"
                   >
                        <mx:Fade
                             alphaFrom="0.0"
                             alphaTo="1.0"
                        />
                   </mx:Parallel>
              </mx:Transition>
         </mx:transitions>
    </mx:Application>
    SignIn module:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
    >
         <mx:RemoteObject
              id="LoginRemote"
              destination="login"
              showBusyCursor="true"
         >
               <mx:method name="sign_in" result="signin_handle(event)" />
               <mx:method name="sign_out" result="signout_handle(event)" />
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.rpc.events.FaultEvent;
                   import mx.utils.ArrayUtil;
                   import mx.rpc.events.ResultEvent;
                   import mx.controls.Alert;
                   import com.brassworks.ValueObjects.CurrentUserVO;
                   import mx.events.VideoEvent;
                   [Bindable]
                   private var this_user:CurrentUserVO = new CurrentUserVO();
                   private function init():void
                   private function signin_handle(event:ResultEvent):void
                        try
                             this_user = event.result as CurrentUserVO;
                             if (this_user.token == null) {Alert.show("Supplied login credentials are not valid. Please try again.");}
                             else
                                  this.parentApplication.setState("ChooseCompany");
                                  //Alert.show("You are now logged in, " + this_user.first_name + " " + this_user.last_name + ".");
                        catch (error:FaultEvent)
                             handleFault(error);
                   private function signout_handle(event:ResultEvent):void
                   private function sign_in(event:Event):void
                        //Alert.show(txt_name.text + "|" + txt_password.text);
                        LoginRemote.sign_in(txt_username.text, txt_password.text);
                   private function sign_out(event:Event):void
                   private function show_error(error:Error, s_function:String):void
                        Alert.show("Method:" + s_function + "\nName: " + error.name + "\nID: " + error.errorID + "\nMessage: " + error.message + "\nStack Trace: " + error.getStackTrace() + "\nError: " + error.toString());
                   private function handleFault(event:FaultEvent):void
                        Alert.show(event.fault.faultDetail, event.fault.faultString);
              ]]>
         </mx:Script>
         <mx:Panel
              id="pnl_signin"
              title="Sign In"
              horizontalAlign="center"
              verticalAlign="middle"
         >
              <mx:Form
                   id="frm_signin"
                   cornerRadius="5"
                   defaultButton="{btn_signin}"
              >
                   <mx:FormItem
                        id="fi_username"
                        label="Username:"
                   >
                        <mx:TextInput
                             id="txt_username"
                        />
                   </mx:FormItem>
                   <mx:FormItem
                        id="fi_password"
                        label="Password:"
                   >
                        <mx:TextInput
                             id="txt_password"
                             displayAsPassword="true"
                        />
                   </mx:FormItem>
              </mx:Form>
              <mx:ControlBar>
                   <mx:LinkButton
                        id="lnk_request_password"
                        label="Forgot your password?"
                        click="currentState='RequestPassword'"
                   />
                   <mx:Spacer
                        id="spc_spacer"
                        width="100%"
                   />
                   <mx:Button
                        id="btn_signin"
                        label="Sign In"
                        click="sign_in(event)"
                   />
              </mx:ControlBar>
         </mx:Panel>
    <!--     
         <mx:states>
              <mx:State
                   name="RequestPassword"
              >
                   <mx:SetProperty
                        target="{pnl_signin}"
                        name="title"
                        value="Request New Password"
                   />
                   <mx:SetProperty
                        target="{btn_signin}"
                        name="label"
                        value="Submit Request"
                   />
                   <mx:RemoveChild
                        target="{lnk_request_password}"
                   />
                   <mx:RemoveChild
                        target="{fi_password}"
                   />
                   <mx:AddChild
                        relativeTo="{spc_spacer}"
                        position="before"
                   >
                        <mx:target>
                             <mx:LinkButton
                                  id="lnk_sign_in"
                                  label="Return to Sign In form."
                                  click="currentState=''"
                             />
                        </mx:target>
                   </mx:AddChild>
              </mx:State>
         </mx:states>
         <mx:transitions>
              <mx:Transition
                   fromState="*"
                   toState="*"
              >
                   <mx:Parallel
                        id="trn_default"
                        targets="{['RequestPassword']}"
                   >
                        <mx:Fade
                             alphaFrom="0.0"
                             alphaTo="1.0"
                        />
                   </mx:Parallel>
              </mx:Transition>
         </mx:transitions>
    -->
    </mx:Module>
    CompanySelection module:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Module
         xmlns:mx="http://www.adobe.com/2006/mxml"
         layout="absolute"
         xmlns:components="com.brassworks.components.*"
         horizontalAlign="center"
    >
         <mx:RemoteObject
              id="CompanyRemote"
              destination="company"
              source="Company"
              showBusyCursor="true"
         >
               <mx:method name="load_by_user" result="getCompanyHandler(event)"/>
         </mx:RemoteObject>
         <mx:Script>
              <![CDATA[
                   import mx.events.ListEvent;
                   import mx.controls.Alert;
                   import mx.core.ByteArrayAsset;
                   import mx.controls.Image;
                   import mx.rpc.events.FaultEvent;
                   import mx.rpc.soap.LoadEvent;
                   import mx.utils.ArrayUtil;
                   import com.brassworks.ValueObjects.CompanyVO;
                   import mx.collections.ArrayCollection;
                   import mx.rpc.events.ResultEvent;
                   public function mod_init():void
                        CompanyRemote.load_by_user("mike");
                   private function getCompanyHandler(event:ResultEvent):void
                        Alert.show('test3');
                        //var results:ArrayCollection = event.result as ArrayCollection;
                        //companies = event.result as ArrayCollection;
                        tll_company_selection.dataProvider = event.result;
                   private function toObject(element:String, index:int, array:Array):Object
                        return {label:element};
                   private function item_click(event:ListEvent):void
                        Alert.show(TileList(event.currentTarget).selectedItem.id.toString());
              ]]>
         </mx:Script>
         <mx:Canvas
              borderColor="#636363"
              backgroundColor="#FCF4DA"
              width="900"
              horizontalCenter="true"
         >
              <mx:TileList
                   id="tll_company_selection"
                   columnWidth="260"
                   maxColumns="2"
                   rowHeight="150"
                   itemRenderer="com.brassworks.components.CompanyTileList"
                   itemClick="item_click(event)"
                   width="520"
                   horizontalScrollPolicy="off"
                   horizontalCenter="0"
                   backgroundAlpha="0.0"
                   borderStyle="none"
                   creationComplete="mod_init()"
              />
         </mx:Canvas>
    </mx:Module>
    CompanyTileList component:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:VBox
         xmlns:mx="http://www.adobe.com/2006/mxml"
         verticalScrollPolicy="off"
         horizontalScrollPolicy="off"
         horizontalCenter="0"
         width="260"
         paddingLeft="5"
         paddingRight="5"
         paddingTop="0"
         paddingBottom="0"
    >
         <mx:Script>
              <![CDATA[
                   import com.brassworks.ValueObjects.CompanyVO;
                   import mx.utils.Base64Decoder;
                   import flash.utils.ByteArray;
                   [Bindable]
                   private var _company_name:String;
                   [Bindable]
                   private var _company_logo:ByteArray;
                   private var _decoder:Base64Decoder = new Base64Decoder();
                   public var _company:CompanyVO;
                   private function tile_list_init():void
                        _company = data as CompanyVO;
                        _company_name = _company.name;
                        _decoder.decode(_company.logo);
                        _company_logo = _decoder.toByteArray();
              ]]>
         </mx:Script>
         <mx:Image
              source="{_company_logo}"
              width="250"
              height="100"
         />
         <mx:Label
              text="{_company_name}"
              creationComplete="tile_list_init()"
              width="100%"
              left="0"
              right="0"
              textAlign="center"
         />
    </mx:VBox>

  • Advice re: view states

    Hi. I created an app that works a bit like a calculator to calculate expenses. As part of the app the user can click on a question mark which brings up an information section - a bit like a "pop-up" - with the original calculator screen still in the background...if i was using Flash I could just keep this "pop-up" on the edge of the stage and then tween it in to view when the user clicks the question mark...i've read up on view states but not sure if this is appropriate for what i want or if there is a better way to do this in flex.
    thx.

    For complex views, you will find ViewStack much easier and
    more intuitive to code.
    But that won't solve your problem. The best solution to this
    is to simply reload the application using navigateToUrl().
    Tracy
    Tracy

  • Selecting View States and TabNavigator Canvases

    Hello all Flex fans...
    I have two questions for somebody who has done this before.
    It will take a bit of explaining so bear with me.
    I have a datagrid called "selClaimant" as the starting point
    of my application. When I select something from the selClaimant
    datagrid I change view states to a view called "ClaimView". In the
    ClaimView state I have a TabNavigator control with several canvases
    called "Claimant" and "Claims" and several others.
    My first question is when I select something from the
    selClaimant datagrid how do I ensure that the Claimant canvas is
    displayed in the TabNavigator and not the Claims canvas???
    My second question is similar to the first but with a twist.
    First off the Claims canvas also has two view states (call them
    "ViewOne" and "ViewMany"). ViewOne has a datagrid control called
    selClaim that allows me to select a claim that has been filed by
    the claimant. ViewMany allows me to see all the details about the
    selected claim. When I select a claimant from the selClaimant
    datagrid I query the database to see how many claims that the
    selected claimant has filed. If there has only been one claim filed
    I want the starting state to be the ViewMany canvas when the user
    clicks on the Claims TabNavigator. If there is more than one claim
    in the database then I want the ViewOne to be displayed so I can
    select which claim I want the detail on.
    I store the number of claims in an array so I can use the
    array length to see if I have one or more claims but I am not sure
    how to logically force my view state and canvas state.
    Thanks in advance to the guru that helps me with this one!!!
    Have an Ordinary Day...
    KomputerMan ~|:-)

    Question one is answered... put this into the action script
    that handles the datagrid selected event.
    claimantTabNav.selectedIndex = 0;
    claimantTabNavigator is the ID of the tabnavigator whose
    canvas I want selected. 0 is the first tab in the navigator. Good
    thing I grew up on UNIX and can still remember how to count
    starting with a 0 instead of a 1. :)
    Have an Ordinary Day...
    KomputerMan ~|:-)

Maybe you are looking for

  • IPod Touch 2.1 Not Backing Up

    I have a first generation 8GB iPod Touch running the latest firmware 2.1. I decided to test Apple's claims for "faster backups" and so I decided to manually back up by right clicking on my iPod in the iTunes sidebar and click "Back Up." However, when

  • Adding a textbox to an image slideshow

    Hi. I am using Dreamweaver CS6 for my website and now I have a very basic question: how do I replace an image over text (a text box?) in a slideshow using javascript? Meaning, I have a gallery of thumbs and when i click on the last thumb instead of a

  • Getting the full file path from FormFile

    Hi, I am reading in a .csv file from my JSP page and I want to pass the String path from my Action class to the logic layer class. When I try and pass it at the moment, it throws an FileNotFound error as it is only passing the file name. i.e Passing

  • Where can I find Dreamweaver transfer log files?

    Does anyone know where I can find my log files from file transfers in Adobe Dreamweaver? I am attempting to find logs from the last week or so, to create a list of deletions from our svn repo.

  • Fetch URL from Application Server of Saved File

    Hi, I wrote a file on the Application Server using Open Dataset commands. i can see it in AL11 transaction as getting saved on the server. How can i fetch the path , where it got saved? Regards, Anantha