Advertisement
Guest User

Untitled

a guest
May 3rd, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [Bindable]
  2. public var currentFacture:ArrayCollection = new ArrayCollection([
  3.   {
  4.     label: "Label 1",
  5.     focused: false
  6.   },
  7.   {
  8.     label: "Label 2",
  9.     focused: false
  10.   },
  11.   {
  12.     label: "Label 3",
  13.     focused: false
  14.   }
  15. ];
  16.  
  17. <s:List id="articleDetailsList"
  18.             width="100%"
  19.             height="100%"
  20.             dataProvider="{currentFacture}"
  21.             selectionColor="#FFFFFF"
  22.             rollOverColor="gray"
  23.             horizontalScrollPolicy="off"
  24.             contentBackgroundAlpha="0"
  25.             borderAlpha="0"
  26.             allowMultipleSelection="false">
  27.     <s:itemRenderer>
  28.         <fx:Component>
  29.             <s:ItemRenderer width="100%" click="outerDocument.itemClicked(event)">
  30.                 <fx:Script>
  31.                     override public function set data(value:Object):void
  32.                     {
  33.                         super.data = value;
  34.                         if (value.focused) {
  35.                           //set focus
  36.                         }
  37.                     }
  38.                 </fx:Script>
  39.  
  40.                 <s:HGroup
  41.                         width="100%"
  42.                         gap="0"
  43.                         paddingTop="10"
  44.                         paddingBottom="5"
  45.                         verticalAlign="bottom">
  46.                     <s:TextInput id="articleQte" text="{data.label}" />
  47.                 </s:HGroup>
  48.             </s:ItemRenderer>
  49.         </fx:Component>
  50.     </s:itemRenderer>
  51. </s:List>
  52.  
  53. //somehwere else in your code to trigger focus on one of the text inputs'
  54. var element = currentFacture.getElementAt(<some index>);
  55.  
  56. //this is needed if there is no way for the collection view to know about the update to the item, such as the data you're changing not being bindable possibly. This informes the ICollectionView that it's been updated and then the List would update to send in the new data object to its set data method.
  57. currentFacture.itemUpdated(element);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement