Uploaded image for project: 'Apache Flex'
  1. Apache Flex
  2. FLEX-34143

Give <fx:Binding /> an event handle.

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Data Binding
    • Labels:
      None

      Description

      1st of all, Flex Binding is great!!!

      I am using it this way:

      >>>>>>>>>>>>>>>>>code>>>>>>>>>>>>
      <fx:Script><![CDATA[
      [Bindable("dataChange")]
      public function get rowData():VLogicTreeGridRow

      { return data as VLogicTreeGridRow; }

      private var _cellData:VLogicTreeGridCell;
      [Bindable(event="cellDataChanged")]
      public function get cellData():VLogicTreeGridCell

      { return _cellData; }

      private function set rfrCellData( v:* ):void{
      if( rowData != null
      && logicTreeGrid.columns != null && logicTreeGrid.columns.length > 0
      && rowData.cellList != null && rowData.cellList.length > 0
      ){
      var idx:int = logicTreeGrid.columns.getItemIndex( treeGridColLogic );
      var rt:VLogicTreeGridCell = rowData.cellList.getItemAt( idx ) as VLogicTreeGridCell;
      if( _cellData != rt )

      { _cellData = rt; dispatchEvent( new Event( "cellDataChanged" ) ); }
      }
      }
      ]]></fx:Script>
      <ui:layout>
      <s:HorizontalLayout paddingTop="2" paddingBottom="2" paddingLeft="2" paddingRight="2"/>
      </ui:layout>
      <fx:Binding source="logicTreeGrid.columns.length" destination="rfrCellData"/>
      <fx:Binding source="rowData.cellList.length" destination="rfrCellData"/>

      <<<<<<<<<<<<<<<code<<<<<<<<<<<<

      Because the destination of Binding tag can only be setters, I have to use it this way if I want to handle changes from the Binding sources, do you think it's possible to add a handle for Binding tag so that I can see exactly what event caused the change please?

      So that it can be like this
      >>>>>>>>>>>>>>>>>code>>>>>>>>>>>>

      private function refreshCellData( ev:Event ):void{
      if( ev is CollectionEvent ){

      }
      else if( ev is PropertyChangeEvent ){

      }
      if( rowData != null
      && logicTreeGrid.columns != null && logicTreeGrid.columns.length > 0
      && rowData.cellList != null && rowData.cellList.length > 0
      ){
      var idx:int = logicTreeGrid.columns.getItemIndex( treeGridColLogic );
      var rt:VLogicTreeGridCell = rowData.cellList.getItemAt( idx ) as VLogicTreeGridCell;
      if( _cellData != rt ){ _cellData = rt; dispatchEvent( new Event( "cellDataChanged" ) ); }

      }
      }
      ]]></fx:Script>
      <ui:layout>
      <s:HorizontalLayout paddingTop="2" paddingBottom="2" paddingLeft="2" paddingRight="2"/>
      </ui:layout>
      <fx:Binding source="logicTreeGrid.columns.length" changeHandle="refreshCellData"/>
      <fx:Binding source="rowData.cellList.length" changeHandle="refreshCellData"/>

      <<<<<<<<<<<<<<<code<<<<<<<<<<<<

      This is going to be very useful!!!

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                flashflexpro Gary Yang
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 672h
                  672h
                  Remaining:
                  Remaining Estimate - 672h
                  672h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified