Replies
Hi,
This was a bit hard to follow, I recommend using a little more descriptive variable names in the future. That being said, in looking at it, when you first use the variable "m" you are using it as the index of the current column. But when you call SelectCell on the last line you are using it as part of the row arg instead of the column arg. SelectCell has two arguments, objRow, objColumn. objRow can be either a numeric or a string. If objRow is a numeric it represents the index of a row on the root band. If objRow is a string, it's a little more complex, but mostly it represents bands and rows, but you are passing in an index of a column, since it's a number, sometimes it may return a valid value, but on a whole it will likely not work as expected.
I am guessing you are looking to SelectCell i, m, but I am not sure what the value "dbvalue" represents, is that supposed to be the column key, or are you trying to set it to the value "dbvalue", in which case I think you want to use SetCellData.
As to how to use the objRow as a string. It is typically used only for hierarchical grids, in which case its a semi-colon separated list of row numbers, starting from the first number being the row on the root band, then continues down that row's child band row number on, repeating on down until it gets to the actual row. It adds a little bit more complexity in that you can have sibling child bands, so that an individual row can have multiple separate bands directly under it, in which case that section of semi-colon separated values is also comma separated, with the first number being the child band index, and the second number being the row number.
That being said when you used SelectCell "i;m", "dbvalue" it translated it as Select the cell of root band row index i's child row index m with a column key of "dbvalue". Which can in theory exist, but will likely fail.
I hope this helps,
Hi dwei,
Unfortunately just looking at the picture I cannot tell you what the cell reference would be. This is because filtering, which you have enabled, and whose effects may not always be viewable because the column filtered could be hidden, and that filtering could be hiding hundreds of rows between the two rows on either or both band shown in your picture.
The reason why we have to take into account hidden rows, is because not all filtering hides rows, it is possible to have their appearance altered instead of removed. That all beings said, the easiest way to find the correct cell reference is to record an action on it, such as ActivateCell or SetCellData.
While this seems more like a straight WinGrid question then a WinGrid for TestAdvantage question. I am pretty sure what you are looking for is :
UltraGridRow[] rowsFiltered = ultraGrid1.Rows.GetFilteredInNonGroupByRows()
What you can do if you have the indexes, and it is grid based. You can use ActivateCell, ActivateCell can use indexes as it's path so you can do :
Tree.ActivateCell "\0\1", "CellColumnName"
It has as a side effect fires the following events:
BeforeActivate
AfterActivate
BeforeSelect
AfterSelect
BeforeCellActivate
AfterCellActivate
And as such should give you the results that you are looking for.
Sri,
I believe it is likely that you also may be dealing with Tree columns instead of a simple tree with the node being just the Text. Try using GetCellData, or contacting your developer to determine what your actual design scenario is.
Basically from what I can tell, you are not displaying the actual node text, you are displaying the first probably two columns with no border and no labels. The actual Text property for the Node is blank. Which is fine if you have the NodeTextColumn for the DisplayColumnSet set to your dominate unique column. The NodeTextColumn basically says, for each Node with a ColumnSet defined, use the value in cell that correseponds with that Column to set the Text property. In the first scenario your NodeTextColumn is either blank, or set to a column with No values in it, and your Text property is also blank. So your path to the Nodes are blank. In the second scenario you have a NodeTextColumn defined, but it's on a non-unique column, so you won't be able to record the way you would expect.
What I would suggest is using GetCellData which instead uses Index path's and Columns
cellVal = tree.GetCellData("\2\1\0", "Column1")
My first thought is that your Text properties are blank, as the Node path is constructed by a leading "\" followed by a "\" delimited path. So that you would have a path like:
\Parent1\Child1\GrandChild1
GetItem just gets the individual Node Text, not the entire path. So that if you are using GetItem on the example above you would get GrandChild1. What do you use to uniquely identify your Nodes in the UltraTree? Can you include a screen shot?