mx:Link in cell renderer

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  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. Similar Questions and Discussions

    1. Datagrid and Cell Renderer
      Hi, I have a datagrid with a Hyperlink cell renderer. Is there a way to pass the data from the row to the cell renderer? I am having great...
    2. ComboBox Cell Renderer
      I'm using a ComboBoxCell class that I got from the Macromedia website to display a ComboBox inside of a DataGrid component. The problem I'm having,...
    3. Row renderer vs. cell renderer
      Cell renderer. I have done this, and it is pretty easy. I tried to make a sample but haven't had time to finish it. Basically, in the set value...
    4. Can ComboBox have cell-renderer
      I need a combobox which has an image and text. I went through all the macromedia documentation , but could not find any thing on cell renderer. I...
    5. cell renderer book/tutorial ?
      Does anyone know of a tutorial or book that covers the cell renderer in any depth? I've been trying to make a multiline cell renderer based on the...
  3. #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

  4. #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

  5. #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

  6. #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

  7. #6

    Default Re: mx:Link in cell renderer

    sorry, i was forgetting to look at the dataProvider...but when i click the image - i get no response....when i click the row, i get my alert box...

    where did i screw it up?

    thanks...
    michelob Guest

  8. #7

    Default Re: mx:Link in cell renderer

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

  9. #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

  10. #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

Posting Permissions

  • You may not post new threads
  • You may 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