Professional Web Applications Themes

mx:Link in cell renderer - Macromedia Flex General Discussion

i have a cell renderer which uses a mx:link do display a shopping cart icon. i want to be able to click it and add the line to the cart - a separate dataGrid. i am currently able to drag and drop to the cart, but cannot figure out how to send the data to the cart from the cell renderer. the problem to me looks like that when the link is clicked, the dataGrid row is not 'techinically' selected. any ideas? thanks......

  1. #1

    Default mx:Link in cell renderer

    i have a cell renderer which uses a mx:link do display a shopping cart icon. i
    want to be able to click it and add the line to the cart - a separate dataGrid.
    i am currently able to drag and drop to the cart, but cannot figure out how to
    send the data to the cart from the cell renderer. the problem to me looks like
    that when the link is clicked, the dataGrid row is not 'techinically' selected.

    any ideas?

    thanks...

    michelob Guest

  2. #2

    Default Re: mx:Link in cell renderer

    I really haven't done all that much with cell renderers, so i am just thinking
    aloud.

    Have you checked listOwner.selectedItem and selectedIndex?

    Also I found this in a different posting on a similar subject:
    listOwner.getItemAt(getCellIndex().itemIndex).colu mnName

    Maybe there are some hints there.
    Tracy

    ntsiii Guest

  3. #3

    Default Re: mx:Link in cell renderer

    In the click event handler for your cell renderer, do this:

    listOwner.selectedIndex = getCellIndex().itemIndex; // this selects the row
    listOwner.dispatchEvent( {type:"change"} );

    This dispatches the change event to all of the listeners for such on the
    DataGrid:
    <mx:DataGrid change="handleChange(event)" ... />

    In the change event handler, event.target.selectedIndex will tell you what has
    been selected.


    peterent Guest

  4. #4

    Default Re: mx:Link in cell renderer

    Peter,
    your suggestion works for me but now when i do this:

    function handleChange(event){
    alert(event.target.selectedIndex.toString());
    }

    ...i get 0, 1, 2, etc - but i cannot get it to display any of the row data...

    i amy be overlooking something simple, but all i get back is blank alert
    boxes...

    thanks...

    michelob Guest

  5. #5

    Default Re: mx:Link in cell renderer

    The selectedIndex is a number. Use it to index your dataProvider: event.target.dataProvider[event.target.selectedIndex]
    peterent Guest

  6. Moderated Post

    Default Re: mx:Link in cell renderer

    Removed by Administrator
    michelob Guest
    Moderated Post

  7. #7

    Default Re: mx:Link in cell renderer

    You would have to post some of your code.
    peterent Guest

  8. #8

    Default Re: mx:Link in cell renderer

    ok i have found my way around the previous problem, but now the following is
    happening....

    i have my main.mxml which has main.as....i also have cart.mxml which has
    cart.as...i have a shoppingCart.as class...in cart.as i have this code:

    var dataObject:ShoppingCart; and i have a drag function which adds the item
    like this: dataObject.addItem(my data)

    in main.as i am trying to do the same thing but initiated by the click - not
    the drag...i have:
    var dataClickObject:ShoppingCart; and i have: dataClickObject.addItem(my
    data)

    the drag functiion puts the data in the cart, the click function will not. i
    do know for sure that my object is getting to the function with
    dataClickObject.addItem(my data) on the click because i can dump it to the
    trace window - it just will not push it to the shoppingCart.as.

    help! this is driving me crazy...

    a side note...the image now works when clicked, but i want to dis-allow the
    entire row from being clicked...any idea on that as well?

    thanks!

    mike

    michelob Guest

  9. #9

    Default Re: mx:Link in cell renderer

    i have fixed all the problems and my add to cart icon is now working...there is
    1 small problem remaining...the item will add to cart when the row is clicked
    as well as just the icon. i set selectable=false and now only the icon works
    which is what i want, but this disbaled the drag to cart...

    HELP!!!!

    thanks in advance...
    mike

    michelob Guest

Similar Threads

  1. Datagrid and Cell Renderer
    By Kris Kros in forum Macromedia Flex General Discussion
    Replies: 10
    Last Post: February 12th, 12:21 AM
  2. ComboBox Cell Renderer
    By JKringen in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: May 16th, 04:47 PM
  3. Row renderer vs. cell renderer
    By ntsiii in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: November 16th, 07:41 PM
  4. Can ComboBox have cell-renderer
    By gumnam in forum Macromedia Flex General Discussion
    Replies: 2
    Last Post: July 28th, 06:35 PM
  5. cell renderer book/tutorial ?
    By Rooster60602 in forum Macromedia Flash Actionscript
    Replies: 0
    Last Post: February 16th, 12:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139