0 Replies Latest reply on Feb 8, 2010 7:31 PM by aayushv

    Binding issues with viewState

    aayushv

      Hi I am having trouble getting my states to work properly with the bindings.

       

      I have a component and there are multiple states defined for that component.

      A state change happens on various situations.

      like a event getting fired or based on the data coming from a service call.

      The currentstate is Bindable to a property (jobstate) in a DataModel ( Singleton ).

      So a state change happens based on the jobstate property thats being set.

       

      But  I am having touble getting the correct state to to show properly.

       

      here is a snippet of the custom component.

       

      <mx:VBox
          xmlns:mx="http://www.adobe.com/2006/mxml"
          xmlns:custom="com.disney.messaging.mailcentral.components.*"
          currentState="{_model.jobState}"
          minHeight="0"
          minWidth="500"
          creationComplete="init()"
          updateComplete="SmartScroll.scroll(event)"
          focusIn="SmartScroll.scroll(event)">

       

       


          <!-- Define view states -->
          <mx:states>
              <mx:State name="{DataModel.SAVING}">
                  <mx:overrides>
                      <mx:SetProperty target="{theForm}" name="enabled" value="false" />
                  </mx:overrides>
              </mx:State>
              <mx:State name="{DataModel.EDITING}">
                  <mx:overrides>
                      <mx:SetProperty target="{saveButton}" name="enabled" value="true" />
                  </mx:overrides>
              </mx:State>       
            
              </mx:State>
             
          </mx:states>

       

      <mx:Button enabled="false" id="saveButton" label="@Resource(key='Application.action.save', bundle='text')" click="saveForm(event)" height="22"
                              />

       

      </mx:VBox>

       

      And the property is being set on saveForrm function.

       

      _model.jobState = null;

       

       

      but the state never changes first time, it works fine when the save button is clicked next time.

       

      Any ideas what might be the issue.

       

      Thanks