3 Replies Latest reply on Jul 12, 2010 6:36 AM by Mike Peterson

    Accessing AdvancedDataGrid row/column directly

    =VA=FyreHeart Level 2

      I run into this problem repeatedly, and every time I have to find a wonky workaround.


      In essence, I need get direct access to a cell in an ADG - properties, data, row index, etc.


      Specifically, this is an accounting application:

      I have an ADG with some deeply nested heirarchical data. Each level gives the user more detail. So, for each "row" in the dataProvider, the ADG has at least three summary rows corresponding to SuperCategory, Category, and SubCategory.


      When a user double-clicks on a number, it's supposed to pop up with the specific budget line items that make up that total. Problem is, when I create a cursor to traverse the ADG, the rowIndex returned by the ListEvent takes summary rows into account, but the dataProvider doesn't. Therefore, I don't get the data the user clicked on, and if they click way down the list it runs off the end and returns an error.




      Row1: SuperCategory Category SubCategory Account1 $Amount1

      Row2:  SuperCategory Category SubCategory Account2 $Amount2







                     Account1 | $Amount1 <- USER CLICKS HERE


      The ADG ListEvent.rowIndex = 3, but the row in the dataProvder = 0. Just subtracting four only works for the first group, b/c apparently the row numbers are cumulative, not heirarchical.


      Using the ADG's indicesToIndex method doesn't work, either, apparently for the same reason. It counts summary rows and runs off the end if you click too far down in the grid.


      So... how do I get the ADG to return Account1 when user clicks on $Amount1?