Accessing DataGrid currentTarget from a dataGridColumn button

I am trying to access the row item clicked from within a datagrib button. Any thoughts? It seems to only accept event or mouseevent...
               public function onDeleteItem(e:Event):void{
                    trace(e.currentTarget.parent);     
<mx:DataGridColumn headerText="Remove" width="60">
                              <mx:itemRenderer>
                                   <mx:Component>
                                         <mx:Box horizontalAlign="center" verticalAlign="middle">     
                                              <mx:Button skin="@Embed('assets/remove_icon.png')"
                                                   buttonMode="true" scaleX=".6" scaleY=".6" click="outerDocument.onDeleteItem(event)" />           
                                         </mx:Box>
                                   </mx:Component>
                              </mx:itemRenderer>
                         </mx:DataGridColumn>

You need to access the dataProvider using the DataGrid selectedItem property.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    <![CDATA[
      import mx.collections.ArrayCollection;
      [Bindable] private var ac:ArrayCollection = new ArrayCollection([
        {test: "one"}, {test: "two"}, {test: "three"}, {test: "four"}, {test: "five"}
      public function clickFunc():void{
        txt.text = dg.selectedItem.test;
    ]]>
  </mx:Script>
  <mx:DataGrid id="dg" dataProvider="{ac}">
    <mx:columns>
      <mx:DataGridColumn dataField="test">
        <mx:itemRenderer>
          <mx:Component>
            <mx:Button label="Click Me" click="outerDocument.clickFunc();"/>
          </mx:Component>
        </mx:itemRenderer>
      </mx:DataGridColumn>
    </mx:columns>
  </mx:DataGrid>
  <mx:Text id="txt"/>
</mx:Application>
If this post answers your question or helps, please mark it as such.
Greg Lafrance
www.ChikaraDev.com
Flex Development and Support Services

Similar Messages

  • Access datagrid column from another column

    Hello
    Basically, I have 2 columns in a DataGrid, both with CheckBox itemRenderers.
    When I check the first checkbox, I want the second to be enabled = false.  I'm stuck.
    Thanks!

    This answers your question:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.events.ListEvent;
          import mx.collections.ArrayCollection;
          [Bindable] private var ac:ArrayCollection = new ArrayCollection([
            {oneSelected: false, twoSelected: false, twoEnabled: true},
            {oneSelected: false, twoSelected: false, twoEnabled: true},
            {oneSelected: false, twoSelected: false, twoEnabled: true},
            {oneSelected: false, twoSelected: false, twoEnabled: true}
          public function changeEnabled(evt:ListEvent):void{
            var origData:Object = ac.getItemAt(evt.rowIndex);
            origData.twoEnabled = origData.twoEnabled == false?true:false;
            ac.setItemAt(origData, evt.rowIndex);
        ]]>
      </mx:Script>
      <mx:DataGrid dataProvider="{ac}" itemClick="changeEnabled(event)">
        <mx:columns>
          <mx:DataGridColumn dataField="oneSelected">
            <mx:itemRenderer>
              <mx:Component>
                <mx:CheckBox selectedField="oneSelected"
                  change="onChange(event);" label="">
                  <mx:Script>
                    <![CDATA[
                      private function onChange(evt:Event):void {
                        data.oneSelected = !data.oneSelected;
                    ]]>
                  </mx:Script>
                </mx:CheckBox>
              </mx:Component>
            </mx:itemRenderer>
          </mx:DataGridColumn>
          <mx:DataGridColumn dataField="twoSelected">
            <mx:itemRenderer>
              <mx:Component>
                <mx:CheckBox selectedField="twoSelected"
                  change="onChange(event);" label="" enabled="{data.twoEnabled}">
                  <mx:Script>
                    <![CDATA[
                      private function onChange(evt:Event):void {
                        data.twoSelected = !data.twoSelected;
                    ]]>
                  </mx:Script>
                </mx:CheckBox>
              </mx:Component>
            </mx:itemRenderer>
          </mx:DataGridColumn>
        </mx:columns>
      </mx:DataGrid>
    </mx:Application>
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • Treo 750 can't access programs list from start or windows button

    Hi first time question. I have treo 750 and just recently can't access any programs from windows or start button. Can't even access memory to delete unnecessary files. What to do?
    thanks Mike
    Post relates to: Treo 750 (AT&T)

    Is this a memory problem you are running into? Have you tried a soft reset?
    Post relates to: Palm Z22

  • Accessing a BinarySearchTree from a button

    Hello I am trying to figure out how to check to see if a certain value is in my BinarySearchTree. I get the value from a Jtextfield and then I can't access my BST from the actionlistner method. here is a snib of my code
    //In with the rest of my GUI code
    class ButtonHandler implements ActionListener
    public void actionPerformed( ActionEvent e )
    String cmd = e.getActionCommand();
    String lastName;
    if( cmd.equals( "Find" ) )
    lastName = txtLastName.getText();
    //Here I would check to see if last name was in my BST, but i can not Access it.
    public static void main(String[] args)
    BinarySearchTree bst = new BinarySearchTree();
    File dataFile = new File("datafile.txt");
    if(dataFile.exists())
    loadBST(bst);
    Project2 app = new Project2();
    app.setVisible( true );
    public static void loadBST(BinarySearchTree bst)
    String fileLine;
    String[] data;
    Person[] people = new Person[300];
    int i = 0;
    try
    BufferedReader br = new BufferedReader(new FileReader("datafile.txt"));
    while( ( fileLine = br.readLine() ) != null)
    data = fileLine.split("\t");
    Person person = new Person( data[0], data[1], data[2], data[3], data[4].charAt(0), data[5]);
    people += person;+
    bst.add( data[0], i );
    i+;+
    +}+
    br.close();
    +}+
    catch( IOException e )
    +{+
    System.out.println("Could not Read the data file.");
    +}+
    +}+
    +}+
    +I have a BST class with a find method that is looking for a String, but i dunno how to access it from my action listener? I have tried declaring my BST with all of my GUI declaration but then i would be tring to reference a Non-static variable in a static method. I am not sure how to do this.
    Edited by: Capt. on Mar 20, 2008 4:21 AM
    Edited by: Capt. on Mar 20, 2008 4:24 AM

    Well, unfortunately I must keep my load static class. If I declare like this..
    public class Project2 extends JFrame
    private JTextField txtLastName, txtFirstName, txtSSN, txtPhone, txtBirthDate;
    private JButton btnFind, btnAdd, btnDelete, btnExit;
    private JRadioButton radMale, radFemale, radDummy;
    private BinarySearchTree bst = new BinarySearchTree();
    public Project2( )
    setTitle( "BSTDataBase" );
    setSize( 300, 300 );
    setLocationRelativeTo( null );
    Is there a way to access that variable anywhere since it would be a class variable now, such as in the main or action listener methods? I think I heard something about ap.tree or something like that, dont know how to use it or the proper syntax though.

  • Special characters into datagrid through the use of buttons

    Hi!
    I have a datagrid for word input, I'm trying to create a "special characters" panel, kind of like google's new "virtual keyboard" thing on google.com, so that the user can enter data into the datagrid cells using characters that aren't on their keyboards.
    I manage to do this just fine, using the solution below. I know this is probably not the best/most effective way to do this, so any suggestions for making the code better will be appreciated. I only started using Flex a month ago.
    grid.addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, selectColumn)
    function selectColumn(event:DataGridEvent):void
    var selectedColumn:DataGridColumn = grid.columns[event.columnIndex];
    selCol = selectedColumn.dataField;
    //The function for adding a special character to the selected datagrid column by clicking a button:
    //(inputWordArray is the dataprovider for the grid called "grid" )
    protected function clickSomeButton(event:MouseEvent):void
    var colIndex:int = new int;
    if (selCol == "from"){
    inputWordArray[grid.selectedIndex].from = inputWordArray[grid.selectedIndex].from + "æ";
    colIndex = 0;
    else if (selCol == "to"){
    colIndex = 1;
    inputWordArray[grid.selectedIndex].to = inputWordArray[grid.selectedIndex].to + "æ";
    inputWordArray.refresh();
    grid.dispatchEvent(new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, false, colIndex, null, grid.selectedIndex));
    The problem is that this only adds a letter at the end of the selected item's value, not at a specific position within the word specified by the position of the cursor. This is what I need to achieve. I have no idea even what to search for, if anyone could please give me a hint that'd be great.

    You will probably need to capture the editor's selectionBeginIndex and
    selectionEndIndex

  • Access to MD03 from another transaction

    Hi Gurus,
    We did a trace to all the users, and one of them used the MD03 transaction. The point is that he has no authorization to this transaction, so probably he is accessing to it from another.
    Could you help me searching any transaction where the user could jump to MD03 from menu, buttons, double click,...?
    Thank you in advance.

    Hi,
    Click on Enviornment>>Navigation profile>>Assign. In the General settings tab page you can assign the navigation profile. Just check whether the navigation profile assigned to the user has the T-code MD03. Check the seetings and t-codes in OM0K - Define navigation profile.
    But as suggested by Mr.Brahmankar kindly check whether it's possible to access the transaction from MD04 if the user doesn't have the authorization of other transaction which he/she is accessing. In your case MD03. I'm not sure about that.
    Regards,
    Lodhi.S

  • Using jsp to read a input from a radio button

    i am trying read a input from a radio button ,normly if the name of radio button is "priority" and if u referrence it as request.getParameter("priority") it shld work right but mine does not.
    <% rs = stmt.executeQuery("select PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><% out.println(rs.getString(1)); %><% out.println(rs.getString(2)); %><br>
    <%
    %>
    is it bcs i am using a loop !! bcs am populating the radio fields from a database

    i am trying read a input from a radio button ,normly
    if the name of radio button is "priority" and if u
    referrence it as request.getParameter("priority") it
    shld work right but mine does not.
    A couple of things not necessarily addressing your problem, but still..
    Avoid too much Java code in the JSP. Use existing tags or write new custom tags to do the task.
    Avoid database access form the JSP itself, if possible.
    <% rs = stmt.executeQuery("select
    PRIORITYNAME,PRIORITYDESC from TBL_PRIORITY ");
    <td>Priority</td>
    <% while(rs.next())
    %>
    <input name="priority" type="radio"><%
    out.println(rs.getString(1)); %><%
    out.println(rs.getString(2)); %><br>
    <%
    %>
    I'm not quite sure what are you trying to do with the above. You want the labels of the radio buttons to be obtained from the database as well as their values, is it?
    Does PRIORITYNAME correspond to the value of the radio button and PRIORITYDESC correspond to the label of the radio button?
    If that's the case, I think you need to do it as follows:
    Radio button is declared as follows in HTML
    <input name="priority" type="radio" value="<%rs.getString(1)"%>><%rs.getString(2)%></input>
    is it bcs i am using a loop !! bcs am populating the
    radio fields from a databaseNo

  • Can't access my dvr from safari

    Hi,
    I have a problem with safari.  I can't access my dvr from the browser.
    After I sign in to my dvr webpage this message comes instead of loading java: The requested URL was not found on this server
    I have this message when I try with Mozilla:
    CacheEntry[http://xx.xxx.xx.xx/application.jar]: updateAvailable=false,lastModified=Thu Jan 01 01:00:00 CET 1970,length=40266
    Missing Application-Name manifest attribute for: http://xx.xxx.xx.xx/application.jar
    Missing Permissions manifest attribute in main jar: http://xx.xxx.xx.xx/application.jar
    java.io.FileNotFoundException: abc (Permission denied)
    Thanks in advance for any help you can provide!

    Sorry... I didn't realize that this problem was common, not rare.
    I remove the Discussion-related cookies and restarted. I did get to the sign-in page this time, but after clicking the sign-in button, I got "An Internal Server Error Has Occurred." (Nothing else on the page.)
    I decided to check cookies again, and the same ones that I eliminated were back again. Needless to say, repeating the exercise didn't work.
    Resetting Safari is out of the question. I have years worth of settings and cookies stored there for a good reason, and I'm not going to start over from scratch. I can't imagine why anyone would, unless they have a whole lot of time on their hands.
    So... I've decided that this is Apple's problem. If I need Apple Discussions I'll use a browser that works.. which apparently is every browser except Safari. Now that's ironic!

  • (ATV2 tv) can't access rented show from my favorites.

    (ATV2 tv) can't access rented show from my favorites. Error is "The iTunes store is currently unavailable. Try again Later." I have updated and rebooted ATV, as well as my router a number of times. I don't want to rent it again, any ideas?

    Thank you! Knowing someone else had the issue helped me fix it on my end!
    I'm guessing it's a server issue of some sorts.. maybe just some accounts. It's not the first time favorites has been broken, last time it was broken I just couldn't enter the favorites area. The spinny thing just appeared forever.
    My fix: though nothing in favorites works (every time I press select on the show I want it displays the same error as you get), from the main menu with the TV shows menu open, but favorites not yet entered, press the up button and it'll move the cursor to the first image in the menu of rentals at the top of the screen. Easier anyway! Didn't know you could!
    On top of that, though I'm now unable to rent via favorites itself, I can do so via the "top tv rentals" thing.
    Hope this helps and they fix it soon! :/

  • Access main stage from a symbol timeline?

    Can I access main stage  from a symbol timeline?
    Eg:
    I have a symbol called "ball" and its own time line. There is a close button at the end of ball's timeline,
    When close button pressed, I want to go back to main timeline.
    Thanks
    Phyle

    Thanks Hemanth.  I will try to explain.
    Open Edge animate. On the main stage I added a label called "home".
    I created circle, converted to symbol, renamed to "ball".
    Inside "ball" , I have a animation, at the end there is a button called "closeBt"
    When "closeBt" pressed, I want to go back to main stage "home"

  • I cannot access my mail from my ipad. I keep getting an error message "MFMessageErrorDomain error 1032". Does anyone know how to fix this?

    I cannot access my mail from my ipad. I keep getting an error message "MFMessageErrorDomain error 1032"

    iOS: Unable to send or receive email
    http://support.apple.com/kb/TS3899
    Can’t Send Emails on iPad – Troubleshooting Steps
    http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
    Setting up and troubleshooting Mail
    http://www.apple.com/support/ipad/assistant/mail/
    Server does not allow relaying email error, fix
    http://appletoolbox.com/2012/01/server-does-not-allow-relaying-email-error-fix/
    Why Does My iPad Say "Cannot Connect to Server"?
    http://www.ehow.co.uk/info_8693415_ipad-say-cannot-connect-server.html
    iOS: 'Mailbox Locked', account is in use on another device, or prompt to re-enter POP3 password
    http://support.apple.com/kb/ts2621
    iPad Mail
    http://www.apple.com/support/ipad/mail/
    Configuration problems with IMAP e-mail on iOS with a non-standard SSL port.
    http://colinrobbins.me/2013/02/09/configuration-problems-with-imap-e-mail-on-ios -with-a-non-standard-ssl-port/
    Try this first - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.)
    Or this - Delete the account in Mail and then set it up again. Settings->Mail, Contacts, Calendars -> Accounts   Tap on the Account, then on the red button that says Remove Account.
     Cheers, Tom
    Tap Settings > Mail, Contacts, Calendar and delete your email account.
    Then tap Settings > Safari > and Tap Clear History and Clear Cookies and Data.
    Now tap Settings > Mail, Contacts, Calendar and re-enter your email account credentials.
    Message was edited by: Texas Mac Man

  • How to access PC files from iPad

    How can I access PC files from my iPad?

    Depends on what kind of files. You have to have an app on your ipad that can open those files and share them.
    You can download the icloud control panel and use that on your pc.
    http://www.apple.com/icloud/setup/
    itunes also supports file sharing:
    To transfer files from your computer to your iPod touch, iPhone, or iPad:
    Connect your iPod touch, iPhone, or iPad to your computer.
    In iTunes, select your device (below Devices), and click the Apps button.
    Below File Sharing, select an app from the list, and click Add.
    In the window that appears, select a file to transfer, and click Choose.
    The file is transferred to your device, and can be opened in the app you selected in step 3.

  • DataGrid SelectedIndices from a different MXML component

    Hello
    I am refreshing a data grid that resides in my main component, from a sub-component. This works if I invoke the web service method to rebind the dataprovider, and I do not reference the datagrid directly from the sub component.
    My trouble is that I use checkboxes in my datagrid. I need to reset the selectIndices of the datagrid, but anytime I try to reference the datagrid directly it is NULL. The datagrid loses its checkbox selections every time I call the refresh, so I must explicitly reset the selectedIndices.
    How can I reset the datagrid's selectedIndices from a different MXML component? Why is my datagrid always NULL in my web service's result event handler?
    How can I directly reference my main component's datagrid, from my sub-component?

    Hi Devtron,
    You can figure this out by using events..
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="onCreationComplete();" xmlns:comp="comp.*">
    <mx:Script>
      <![CDATA[
       private function onCreationComplete():void
        comp2.addEventListener("refreshGridEvent",refreshGrid);
       private function refreshGrid(event:Event):void
        comp1.dataGrid.dataProvider = null;
      ]]>
    </mx:Script>
    <comp:Component1 id="comp1" />
    <comp:Component2 id="comp2" />
    </mx:Application>
    Now in your Component2 dispatch the refreshGridEvent event either on a button click or when your UI elements changes based on your requirement...this.dispatchEvent(new Event('refreshGridEvent')); and listen for the evet in manin mxml file and change the dataProvider of the dataGrid in Component1.
    Note: This solution is if your both components are placed in the main mxml file. Is your structure is same as I mentioned in the code above..I mean
    whether your two components are placed in the main mxml file.
    Thanks,
    Bhasker

  • How to access next record from database on to form

    hi
    i have written the following piece of code to retrieve data from database oon to form...
    Try
                rset = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                query = "Select * from [@TEST]  where Code =  ('" + oform.Items.Item("6").Specific.value + "') "
                rset.DoQuery(query)
            Catch ex As Exception
                SBO_Application.MessageBox(ErrorToString)
            End Try
            '  oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
            oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
            oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
    but i can see only one record on my form controls.... i have placed on more button called " Next" so that i can access next records from DB when i click on "Next" button...
    Public Sub NextRecords()
    Try
         rset.MoveFirst()
                While Not rset.EoF
                 '   oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
                   oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
                  oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
                   rset.MoveNext()
                End While
                rset.MoveNext()
          Catch ex As Exception
               SBO_Application.MessageBox(ErrorToString)
          SBO_Application.MessageBox("Updated")
           End Try
    End sub
    i'm not able to access next records...
    plz provide me the solution and code for this how to handle this scenario....

    From your question and code sample given, I think the problem is you are seeing only the last record when pressing the next button.
    In the Next button press, you are coded such a way that it will populate the last record.
    Try removing the do..While.. loop and simply code like
    if Not rset.EoF
    rset.MoveNext()
       oform.Items.Item("6").Specific.value = rset.Fields.Item("Code").Value
       oform.Items.Item("7").Specific.value = rset.Fields.Item("Name").Value
       oform.Items.Item("8").Specific.value = rset.Fields.Item("U_Sal").Value
    end if
    So when you click next, you can see the next record. Not the last record.
    Anoop

  • Can't access my iMac from a Windows 98 PC

    When I was prompted for password on the PC running Win 98, I simply clicked "OK" as I had not set any user password on my iMac. However, I got the "wrong password" message and therefore failed to access my iMac from that PC.
    On the PC, I could ping the iMac without problems. I can also access the PC from my iMac. I have the username on the PC that is exactly the same as the one I have enable "Windows Sharing".
    Any clues on this?

    Thanks James.
    I tried but without luck. The issue is, it prompts me for password and whatever I input, it says wrong password. In fact, I do not have any password set on my iMac and therefore I should be let through if I simply click the "OK" button on the password dialog without putting anything in the password field.

Maybe you are looking for

  • My music library is hiding(but still there) on my Zen 32

    Hey. So for the past /2 of the year or so, I've found that my Zen was mysteriously becoming incompatible with a 3rd party app for last.fm. I never figured out why, and I assumed it was a fault in the app, since it had never been completed and was lef

  • User exit or badi for item text in mir7 transaction

    Hi Gurus, Please provide me suitable user exit or enhancement or badi for this requirement. client enter TEXT fied data in MIGO transaction for material document and purchase order in where tab. in MIR7 i entered reference number as material document

  • Clock changes time randomly

    Has any one had any issues with their clock changing time randomly on their iphone 5c? it will go up in time then back several times during the day. I am the only one in the house that this is happening to

  • Restoring iphone to ipod

    I have an old iphone 3GS that was a work phone.  It no longer has a SIM Card, but I was using it as an ipod.  I needed to restore it, but now it is looking for the SIM card to finish the setup.  Is there anyway to get through the setup without the SI

  • IChat v Skype - 'fail to respond' etc

    I have been using Skype on my Mac for a long time, and recently decided to try out iChat AV with friends living overseas. They have Macs too. I find iChat has superior audio capabilities but it has serious problems with such issues as 'user failed to