We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridGroupingControl Getting Records in Custom CellRenderer during Draw event

I have a custom CellModel and CellRenderer. The CellRenderer draws a special "graph" based on values from 3 columns in the each row. I pass the names of the columns into the constructor of the Model, which passes it to the constructor of the renderer. During the renderer''s Draw method, I cannot correctly get the record / data I need. I cannot find a GetRecord method of anything exposed to the Renderer, so I''m trying to use Grid.Model[rowIndex, x], where X is defined by: int x = grid.Model.NameToColIndex(columnName) This works, as long as the Visible Columns Collection hasn''t changed. However, if it has, then the data returned by this call is for the wrong columns. Bottom Line: How do I get to the correct record data during the renderer''s Draw method? There is no GetRecord() method available to the GridTableControl class that is returned by the base Grid class in the renderer. There is likewise, no GetRecord() method in the Grid.Model (of type GridTableModel) HOW DO I GET THE RECORD? Going Nuts. Eric

2 Replies

ER Eric Robishaw April 28, 2006 08:56 PM UTC

Updated Question: I finally figured out that I needed to cast the base Grid object to GridTableControl. NOW... How do I get the appropriate Record Row Index from the Grid Row index passed into the Draw method of the CellRenderer Class? The following DO NO return the correct row when the grid is SORTED: gtc.Table.Records[rowIndex] gtc.Table.Records(gtc.GetClientRow(rowIndex)) BOTTOM LINE QUESTION: Using GridTableControl object, and the (visible) rowIndex provided by the Draw Method of the GridCellRenderer, how do I get the correct Record?


ER Eric Robishaw April 28, 2006 09:56 PM UTC

OK... after much digging: //CAST the Grid object to GridTableControl GridTableControl gtc = (GridTableControl) Grid; //Get the underliying elemement Element el = gtc.Table.DisplayElements[rowIndex]; //Get the element Record Record record = el.ParentRecord; >Updated Question: > >I finally figured out that I needed to cast the base Grid object to GridTableControl. > >NOW... >How do I get the appropriate Record Row Index from the Grid Row index passed into the Draw method of the CellRenderer Class? > >The following DO NO return the correct row when the grid is SORTED: > >gtc.Table.Records[rowIndex] >gtc.Table.Records(gtc.GetClientRow(rowIndex)) > >BOTTOM LINE QUESTION: >Using GridTableControl object, and the (visible) rowIndex provided by the Draw Method of the GridCellRenderer, how do I get the correct Record? > >

Loader.
Live Chat Icon For mobile
Up arrow icon