0 Replies Latest reply on Jun 18, 2007 12:48 AM by yasir.nawaz

    Datagrid Guidance


      I am trying to implement a custom cell renderer to display rating stars against the number value from the data provider of the DataGrid (a rating system for songs).

      Obviously the user should be able to change the ratings and i am facing problems while trying to implement that.

      I tried to use two approaches.
      - First i tried to write an onPress function in the custom cell renderer.
      Getting the _xmouse when mouse is pressed and setting the rating accordingly.
      It works fine, the rating changes
      but the problem is that i cannot update the DataProvider(i dont know which row of the DataGrid was updated).
      Solutions i am unable to implement:
      - If someone can tell me how i can know which specific row was clicked
      - or how can i call the CellPress function after my code has executed in order to update the DataProvider of the DataGrid

      - Secondly i tried another approach
      Getting the _xmouse value in the cellPress function, changing the DataProvider value, and replacing the row using DataGrid.replaceItemAt function.

      var xPos = _xmouse - 552;
      if (xPos <= 1) strSongs[playable[sel]].rating = 0;

      The problem in this case is that _xmouse is received w.r.t. the main flash movie and this approach gives unexpected results if the any column has been resized or removed or if the datagrid has been scrolled horizontally.
      Solution which i am unable to implemet:
      - Can anyone tell me how can i get _xmouse w.r.t. the Rating column?

      I think that the second approach is better but if only i can know who to get the _xmouse value w.r.t. the rating column. At the same time, the first approach does give the _xmouse value w.r.t. the Rating column.
      Thanks in Advance.

      Yasir Nawaz