How to access Dropped datagrid items?

I have an MXML component that has 2 datagrids, where the user drags items from one to the other.
They are bound to these 2 variables:
[Bindable]
public var itemChoicesList:XMLList;
[Bindable]
public var itemChosenList:ArrayCollection;
I was using an array collection since later I need to do some concatenating of all the steps; it I can do this with XMLList, please let me know.
Anyhow:
The left one is:
<mx:DataGrid id="choices"  dataProvider="{itemChoicesList}" width="100%" height="100%"
wordWrap="true" variableRowHeight="true" dragEnabled="true" dropEnabled="true" dragMoveEnabled="true"
styleName="promptGrid" showHeaders="false">
<mx:columns>
<mx:DataGridColumn dataField="@ln1" headerText=""/>
</mx:columns>
</mx:DataGrid>
The right one:
<mx:DataGrid id="chosen" dataProvider="{chosenList}" width="100%" height="100%"
wordWrap="true" variableRowHeight="true" editable="true" dropEnabled="true"
dragEnabled="true" dragMoveEnabled="true"  styleName="promptGrid"
dragEnter="dragEnterChosen(event)" dragDrop="dragDropChosen(event)" showHeaders="false">
<mx:columns>
<mx:DataGridColumn dataField="@ln1" headerText="" editable="false" />
</mx:columns>
</mx:DataGrid>
OK, fine.  I populate the "choices" one when I instantiate the component, from the parent app:
recipeStep.itemChoicesList = step..item;
Works fine.  I can drag items over, great.   My question is, I need to access the items in this datagrid from other places in the application, as they are dropped.  What is the best way to do this?

If this post answers your question or helps, please mark it as such.
To add a row to the DataGrid you really need to just add data to the dataProvider collection object.
You can access components by going through the main app:
mx.core.Application.application.myA.myVar = myC.cVar;
But you should really be using custom events to communicate between components, though it is more complex. Here is my Flex 3 Cookbook post of the topic of custom events:
http://cookbooks.adobe.com/post_Building_a_wizard_using_a_simplified_MVC_architect-11246.h tml
Here are some sample apps on custom events on my web site (right click to View Source):
http://www.chikaradev.com/learning/flex3/customevents/CustomEventSimple/CustomEventSimple. html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents1/index.html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents2/CustomEvents2.html
http://www.chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
Here is my tutorial on custom events:
http://www.chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf

Similar Messages

  • How to access the datagrid in one mxml in another component

    I have a datagrid in a.mxml. when click on the add button, it comes to a b.as file (not a class) to do some things and then, b.as call a popupwindow (c.mxml) to add a row into table (call backend). After I added the row to database table successfully, I want to add the row into datagrid to display, but I could not access the datagrid in a.mxml from c.mxml. How can I do this?
    Thank you in advance.

    If this post answers your question or helps, please mark it as such.
    To add a row to the DataGrid you really need to just add data to the dataProvider collection object.
    You can access components by going through the main app:
    mx.core.Application.application.myA.myVar = myC.cVar;
    But you should really be using custom events to communicate between components, though it is more complex. Here is my Flex 3 Cookbook post of the topic of custom events:
    http://cookbooks.adobe.com/post_Building_a_wizard_using_a_simplified_MVC_architect-11246.h tml
    Here are some sample apps on custom events on my web site (right click to View Source):
    http://www.chikaradev.com/learning/flex3/customevents/CustomEventSimple/CustomEventSimple. html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents1/index.html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents2/CustomEvents2.html
    http://www.chikaradev.com/learning/flex3/customevents/CustomEvents3/CustomEvents3.html
    Here is my tutorial on custom events:
    http://www.chikaradev.com/learning/flex3/customevents/StudentsTutoringCustomEvents1.pdf

  • How to colour drop-down items in enumertor control

    Hi. I know how to modify the controls by customizing  capabilities.
    However, when it comes to enumerator control, I can only change the colour of the top item.
    But I cannot change the colour of the drop-down list of tems in enumerator control.
    Anyone ever done this before?
    Message Edited by astroboy on 11-23-2005 03:33 AM

    Hi
    you can do it programatically
    take a property node of the enum and use named numeric colors properties.
    Tushar Jambhekar
    [email protected]
    Jambhekar Automation Solutions
    LabVIEW Consultancy, LabVIEW Training
    Rent a LabVIEW Developer, My Blog

  • How to access the form items dynamically

    The issue here is that I want to acces the value in the textboxes dynamically
    Here is the code ( I know its wrong )
    <cfset temp = TaskEntryIDs.Split(',') />
        <cfloop index="x" from="1" to="#arrayLen(temp)#">
        <cfset TempControl = "Form.t"&temp[x]>
        <cfif isdefined("Form.t"&temp[x])>
             <cfoutput>#"Form.t"&temp[x]#</cfoutput><br/>
        </cfif>
        </cfloop>
    I don't know the correct way to access it, I know that the textbox name start with T and the task number
    I know that the textbox for the task number 74 is t74, but how can I access the value of this text box so I can insert it into to the database ?
    Please help me
    Thanks

    Array Notation:
    Form["t" & temp[x]]
    StuctKeyExists() is an easier function to determine dynamic form fields exist.
    <cfif structKeyExists(form,"t" & temp[x])>  rather then isDefined().

  • How to accessing item renderers in action script??

    Hi
    I am working on itemrenderes in Flex!
    I have link button component as item renderer inside one of the data grid column, please find my piece as below!
    Now how do we make that item render invisible once we click on it!
    We need to make that link button invisible to the user!
    Let me know how to access like this!
    public function onClick():void {
                // we use our custom component as the template for the popup window
                var confirmWindow:TitleWindow = TitleWindow(PopUpManager.createPopUp(this, ConfirmationPopUp, true));
                // you will only need to take care of the yes response since you don't have to do anything
                // if the response was a no
                confirmWindow.addEventListener("selectedYes", function():void {  
                            //Alert.show("Can be Upgraded to an Alarm");
                            upGradeEventToAnAlarm();
                confirmWindow.addEventListener("selectedNo", function():void {         
            public function upGradeEventToAnAlarm():void
                eventRO = new RemoteObject();                  
                      eventRO.destination = "eventBrowser";
                      eventRO.upGradeEventToAlarm.addEventListener("result",getResultHandler);                 
                      eventRO.addEventListener("fault", getFaultHandler);
                      eventRO.upGradeEventToAlarm(eventsDataGrid.selectedItem.id);
            private function getResultHandler(event:ResultEvent):void
                      //eventsDataGrid.dataProvider.removeItemAt(eventsDataGrid.selectedIndex)
                      if(event.result == true)
                       Here I need to access the link button which is clicked and need to make invisible
    Alert.show("Successfully  Upgraded to an alarm");
                      else
                            Alert.show("Cannot be Upgraded to an alarm");  
                //Fault Handler.             
                private function getFaultHandler(event:FaultEvent):void 
                      Alert.show(event.fault.faultString, 'Error');
                ]]>
    </mx:Script>           
          <mx:TabNavigator x="24" y="25" width="95%" height="90%"
                styleName="MyTabNavigator" horizontalGap="-20"  backgroundColor="#e6e4e5">
                <mx:Canvas label="View" width="100%" height="100%" >
                      <mx:DataGrid id="eventsDataGrid" dataProvider="{myModel.eventsList}"
                             height="90%" width="98%" x="10" y="23" >
                      <mx:columns>
                      <!--  <mx:DataGridColumn  id="iconFlagID" headerText="IconFlag"
                                  dataField="iconFlag" visible="false"/>-->
                            <mx:DataGridColumn  headerText="EventID" dataField="id" visible="false"/>
                            <mx:DataGridColumn  headerText="Event Name" dataField="eventName"/>
                            <mx:DataGridColumn  id="catFieldId" headerText="Category"
                                  dataField="category"/>
                            <mx:DataGridColumn  headerText="AlarmName" dataField="alarmName"/>
                            <mx:DataGridColumn  headerText="Severity" dataField="severity"/>
                            <mx:DataGridColumn  headerText="Source" dataField="source"/>
                            <mx:DataGridColumn  headerText="Updated Time" dataField="updateTime"/>
                            <mx:DataGridColumn  headerText="Description" dataField="description"/>
                            <mx:DataGridColumn  id="upgradeLinkButtonId" 
                                  headerText="Upgrade To Alarm" dataField="iconFlag">                          
                            <mx:itemRenderer>
                            <mx:Component>
                    <mx:Box height="100%" width="100%">               
                    <mx:LinkButton id="eventsLinkButtonID" textDecoration="underline"
                                  icon="@Embed(source='assets/eventsBrowser/images[97]1.JPG')"
                                  click="outerDocument.onClick();" visible="{!data.iconFlag}"
                                  textAlign="center" includeInLayout="true">
                    </mx:LinkButton>                                       
                            </mx:Box>
                    </mx:Component>
                    </mx:itemRenderer>
                            </mx:DataGridColumn>
                      </mx:columns>    
                      </mx:DataGrid>
    Thanks in advance
    Aruna.S.N.

    Hi Prashant
    Thanks for your reply!
    But where my viewStack need to be declared??
    Is it inside dataGridColumn if so its giving error as comonent declaration is not allowed here!
    Tell me how to go about!
    Thanks in advance
    Aruna.S.N.

  • The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar? Also would like to know if the toolbars can be put on the same line to make more room on the page (drag & drop) ??

    The bookmarks toolbar is there but has no item buttons on it. How do I get the items back for this toolbar?
    Also would like to know if the toolbar can be put on the same line to make more room on the page (drag & drop) ?? Like the menu & bookmarks toolbar could/should fit on same line. This would add more page view...
    Floyd Perry
    Thanks

    Check that you still have the "Bookmarks Toolbar items" placed on the Bookmarks Toolbar
    * Make sure that you have the "Bookmarks Toolbar" visible: "View > Toolbars"
    * Check in "View > Toolbars > Customize" that the "Bookmarks Toolbar items" is on the Bookmarks Toolbar
    * If the "Bookmarks Toolbar items" is not on the Bookmarks Toolbar then drag it back from the Customize window onto the Bookmarks Toolbar
    * If you do not see the "Bookmarks Toolbar items" then click the "Restore Default Set" button
    You can only move the content from a toolbar onto other toolbars if all toolbars support that feature. You need to check that in the options of each toolbar.

  • How to access the value of application item in javascript

    How to access the value of application item in javascript?

    Hi,
    One way
    var myVariable = '&MY_APP_ITEM.';Br,Jari

  • Datagrid Drop Down Item renderer Scroll Problem

    Hi,
    I am having a problem with an drop down item renderer on a Datagrid.  When ever the datagrid is displayed and the cell is clicked on i want this to display a drop down list of objects.  I can get the drop down to appear with the list of objects.  H
     owever the scrollbar does not work on this item to allow the user to scroll through all the objects.  If you use the mouse wheel you can scroll down through them all but not when you try and click on the scroll bar to drag down.  Below is the code used.  Any advice why this might be happening?? 
    <mx:DataGridColumn headerText="Widget"
    dataField="WidgetName"
    editable="true"  headerWordWrap="false" textAlign="center" width="100"
    editorDataField="Widget">
    <mx:itemEditor>
    <fx:Component>
    <s:MXDataGridItemRenderer focusEnabled="true" height="22" >
    <fx:Script>
    <![CDATA[               
    import mx.events.FlexEvent;
    import spark.events.IndexChangeEvent;
    private var selectedWidget:Widget = null;
    public function get ccyPair():String {
    return  ddlCcyPairs.selectedItem.Widget;
    override protected function commitProperties():void {
    super.commitProperties();                
    trace("Commit .......");
    protected function ddlCcyPairs_changeHandler(event:IndexChangeEvent):void {
    for each(var ccyP:CurrencyPair in ddlCcyPairs.dataProvider) {
    if (ccyP.ccyPair == ddlCcyPairs.selectedItem.ccyPair) {
    selectedWidget = ccyP;
    ddlCcyPairs.selectedItem = selectedWidget;
    protected function ddlCcyPairs_creationCompleteHandler(event:FlexEvent):void {                 
    for each(var ccyP:CurrencyPair in ddlCcyPairs.dataProvider) {
    if (ccyP.ccyPair ==  data.ccyPairName) {
    selectedWidget = ccyP;
    ddlCcyPairs.selectedItem = selectedWidget;
    ]]>
    </fx:Script>
    <s:DropDownList id="ddlWidgets" width="100%"
    dataProvider="{parentApplication.Widgets}"
    labelField="name"              
    selectedItem="selectedWidget"
    creationComplete="ddlWidgets_creationCompleteHandler(event)"
    change="ddlWidgets_changeHandler(event)"/>
    </s:MXDataGridItemRenderer>
    </fx:Component>
    </mx:itemEditor>
    </mx:DataGridColumn>

    Hi, Post a test code.... It will be a lot easier to help you Mich

  • How to Access Item Names Property of ListBox inside of Cluster?

    In LabVIEW 2010 I have a Cluster of Controls on the Front Panel. In that Cluster I have a ListBox. How do I access the Item Names Property of the ListBox in my Block Diagram.
    From the Cluster, I can get the ListBox, but that returns an I32 value, probably the index of the selected Item.
    In the Block Diagram, how can I get the Item Name Property of the ListBox from a Reference to the Cluster?
    THANKS.
    Solved!
    Go to Solution.

    by using the "controls" array of your cluster, you can access the individual elements. You have then to convert the reference to a "more specific class" using a reference to an arbitrary listbox (or a constant reference of the required type), then you can access all properties of your listbox.
    THINK G!! ;-)
    Using LabView 2010 and 2011 on Mac and Win
    Programming in Microsoft Visual C++ (Win), XCode (Mac)

  • How access SWF Library items?

    Is it possible to access SWF Library items from main FLA?
    Ex:
    I am loading swf on level1, i want to access level1 library
    items from level0 file

    You'll need to get the FLA for the file to see how the
    linkage is set up. Other option, though not ideal, is to get ahold
    of a SWF decompiler, and create a new FLA where you know the
    linkage id's.

  • How can access every item on a HorizontalList Component

    Hi,
           I would like to know how can I access every item on a HorizontalList component. What I want to do is something like this:
    My HorizontalList:
    <mx:HorizontalList
            bottom="0"
            backgroundAlpha="0.0"
            id="catalogoOpciones"
            columnCount="3"
            height="80"
            hideEffect="{esconderse}"
            horizontalScrollPolicy="on"
            selectable="false"
            showEffect="{mostrarse}"
            width="100%">
            <mx:itemRenderer>
                <mx:Component>
                    <mx:VBox  height="100%" verticalGap="0" horizontalAlign="center">
                        <mx:Label id="titulo" text="{data.nombre}"  textAlign="center" styleName="nombreOpcionDetallePlato" />
                        <mx:ComboBox id="seleccion" dataProvider="{data.opciones}" labelField="label" labelFunction="funcionLabelComboBox"                                         styleName="comboOpcionDetallePlato" change="dispatchEvent(new Event('cambioOpcion',true))"/>
                        <mx:Script>
                            <![CDATA[
                                public function funcionLabelComboBox(item:Object):String {
                                        return item.label + ", $" + item.precio;
                            ]]>
                        </mx:Script>
                    </mx:VBox>               
                </mx:Component>
            </mx:itemRenderer>
        </mx:HorizontalList>
    What I want to do is to show on an Alert screen the selected index in every ComboBox on the horizontallist:
    for(var i:Number=0;i<horizontalListt.dataProvider.length;i++){
         var indice:Number = (horizontalListt.dataProvider.getChildAt(i) as ComboBox).selectedIndex;
        Alert.show(indice.toString());
    I must add, that the horizontalList is working just fine, the only thing that's giving me problems is the access to every item in the list.
    Thank you very much for your time and help.
    Sebastián Toro O.

    Greg, thank you for your quick response, but your answer is a little ambiguous for me. How can my dataProvider change when the user selects another index? the itemRenderer it's supposed get the information off the dataProvider to fill its ComboBoxes, but when the user selects another index, that change shouldn't have any effect on the dataProvider.
    remember that the itemRenderer is:
    <mx:itemRenderer>
                <mx:Component>
                    <mx:VBox  height="100%" verticalGap="0" horizontalAlign="center">
                        <mx:Label id="titulo" text="{data.nombre}"  textAlign="center" styleName="nombreOpcionDetallePlato" />
                        <mx:ComboBox id="seleccion" dataProvider="{data.opciones}" labelField="label" labelFunction="funcionLabelComboBox"                                                   styleName="comboOpcionDetallePlato"  change="dispatchEvent(new Event('cambioOpcion',true))"/>
                        <mx:Script>
                            <![CDATA[
                                public function funcionLabelComboBox(item:Object):String {
                                        return item.label + ", $" + item.precio;
                            ]]>
                        </mx:Script>
                    </mx:VBox>               
                </mx:Component>
            </mx:itemRenderer>
    So what I whant to access, is every Component that the itemRenderer created:
    Alert.show(((catalogoOpciones.dataProvider.getItemAt(0) as VBox).getChildByName("seleccion") as ComboBox).selectedIndex.toString());
    I want to get the selectedIndex of the ComboBox of the First Item that was created on the  HorizontalList. I thought the last line of code would do the trick but it doesn't. Could you be more specific please?
    Thanks again
    Sebastián Toro O.
    PS:don't worry that if you answer my question you'll get the 10 pts

  • How To Access PAGE ITEM (single row) from HTML source

    Hi Guys,
    I have a page Item that return a string.
    I would like to show this string
    How To Access PAGE ITEM (single row) from HTML source?
    My desire final output is
    <marquee>:P1_PAGE_ITEM</marquee>
    Can please help me
    Thanks

    Hi,
    You can refer the page items in your page header as &itemname. For example, if I have page item P15_TEST, I will add the following in header:
    <marquee>
       &P15_TEST.
    </marquee>But make sure that you have a process before header to populate the value in your page item. Otherwise, there will be a null scrolling (which you can't see!) :)
    Regards,
    Zahid

  • How can I drag and drop an item from one Tree control to another in LabVIEW 7.1?

    You can use the mouse up and down event on the two tree controls but the problem is making the correct selection in the second tree control. I want to be able to switch over to the selection bar of the second tree control so that I can place my item in the correct position. I know all possible workarounds with double-clicks and so on... but I really want a windows drag and drop.
    This is what I have for the moment. Please check the library below. I need to activate the selection bar of the second tree control somehow to get the position in the control. The VI below is written in LV 7.1
    Attachments:
    Drag&Drop.llb ‏65 KB

    Hi Jones,
    As far as I know this feature is currently not supported by the Tree control. A workaround, would be to use the vertical position of the mouse in the button up event to determine what line you�re dropping the item.
    If you would like the Tree control to include the drag and drop feature, please submit this as a Product Suggestion under the feedback at www.ni.com/contact.
    Good luck!
    Best regards,
    Philip C.
    Applications Engineer
    National Instruments
    www.ni.com/ask
    - Philip Courtois, Thinkbot Solutions

  • How do I overcome Keychain access "Access to this item is restricted".  I need to view a password stored in Keychain

    I am the adminstrator and only user of this MacBook.  I need to see an internet password which is not stored on my browser or email client.  When I go into Keychain Access and check the Show Password box it asks for Keychain password - that is no problem. Enter password, hit OK, then the message comes up Access to this item is restricted.  I have gone into File - Get Info and made it read and write to Administrsators, System, Wheel and myself but it still says Restricted.  Any ideas anyone PLEASE!!

    I posted the same question elsewhere, but after poking around I discovered the following, which might be helpful. 
    Open Keychain Access, which is in your Applications/Utilities folder.  There should be two sections on the left sidebar, Keychains and Category.  When I opened it, only the Category section showed, but I eventually found an arrow which expanded the Keychains section. 
    Choose Login in the Keychains section, and "Passwords" in the Category section.  Use the search field to find the program you need the password for, and double-click on it.  A window with that program's label will open.  Under the Attributes tab, click on the little Show Password checkbox.  You'll be asked for your admin password.  Once you've entered it, the password will appear in the Show Password field.
    As an aside, I thought this is what I was doing all along, so here's another thing I did before it started working:  I found Keychain First Aid and ran both the Verify and Repair options.  Both of these reported no problems, but it might have done something to encourage things to work right.*
    *As you can tell, I anthropomorphize my electronic devices.  It's the only way to cope with the way they misbehave.

  • TS3276 When I try and access my sent items- mail quits due to an error? How do I resolve this?

    Just last eek, the mail started generating an error message, when I try to access my sent items folder. I can receive and send emails but for reference of items that I have sent, I cannot access them as it says that 'mail quit unexpectedly'. Please can someone offer any advice- It doesn't give a specific code either? The message is as follows... (and more)... It says that the report will be sent to Apple but then what?...
    Process:         Mail [2137]
    Path:            /Applications/Mail.app/Contents/MacOS/Mail
    Identifier:      com.apple.mail
    Version:         4.5 (1084)
    Build Info:      Mail-10840000~1
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [1889]
    Date/Time:       2012-05-14 12:08:26.211 +0100
    OS Version:      Mac OS X 10.6.8 (10K549)
    Report Version:  6
    Interval Since Last Report:          150366 sec
    Crashes Since Last Report:           10
    Per-App Interval Since Last Report:  141708 sec
    Per-App Crashes Since Last Report:   10
    Anonymous UUID:                      71421F5A-9DD0-467B-92C6-3C58F25777E8
    Exception Type:  EXC_CRASH (SIGABRT)
    Exception Codes: 0x0000000000000000, 0x0000000000000000
    Crashed Thread:  14
    Application Specific Information:
    -[MessageContentController _fetchContentsForMessage:fromStore:withViewingState:]
    abort() called
    *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ABGroup nts_CustomImageData]: unrecognized selector sent to instance 0x114c46ad0'
    *** Call stack at first throw:
              0   CoreFoundation                      0x00007fff83d93784 __exceptionPreprocess + 180
              1   libobjc.A.dylib                     0x00007fff8a144f03 objc_exception_throw + 45
              2   CoreFoundation                      0x00007fff83ded110 +[NSObject(NSObject) doesNotRecognizeSelector:] + 0
              3   CoreFoundation                      0x00007fff83d658ef ___forwarding___ + 751
              4   CoreFoundation                      0x00007fff83d61a38 _CF_forwarding_prep_0 + 232
              5   AddressBook                         0x00007fff84bf08d7 -[ABRemoteImageLoader workLoop] + 1548
              6   Foundation                          0x00007fff823de114 __NSThread__main__ + 1429
              7   libSystem.B.dylib                   0x00007fff888e3fd6 _pthread_start + 331
              8   libSystem.B.dylib                   0x00007fff888e3e89 thread_start + 13

    Try rebuilding the mailbox.
    To do that
    1) Launch Mail,
    2) Select the account
    3) In the Mailbox menu, select Rebuild.

Maybe you are looking for

  • Printing directly to printer in Reporting Services 2008 problem

    We have recently installed a new SQL 2008 server.  I have an application that prints an SSRS report (2005) directly to the printer.  If I change the reference to point to the new SQL 2008 server and run the application, the report is printed but the

  • ODS Activation Problem (with SIDS) BIG PROBLEM !!!

    Hi Ok we have a situation in our project but first a few facts: - 1: For ODS we do not use keys but have a infobject that creates a unique ID for each entry with a bit of ABAP in the update rule (yep not very good I know but too many to change now) 2

  • TS3899 Email receiving problem

    Question. My Ipad will not display email message content nor attachments, only subject and sender. Preview column does show detail of lines selected. I can access message content by selecting "reply" option but cannot view attachments. Any suggestion

  • What are all the components and attrubutes of the SAP script

    hi what are all the components and attrubutes of the SAP script please reply thanks in advance

  • Change TM drive ---deleteing TM files

    I've got TM up and running smoothly, with several backups on my external drive. 1) Can I now copy my TM data to another (larger) drive (via a simple drag and drop in Finder), then change my destination drive in TM and have it continue to update that