Hi,
I am using UFT 12.01 (.NET Add-In/Web Add-In) and Infragistics 2010 v.1
I am trying to get the columns names of a Win.UltraWinGrid.UltraGrid, and I am able to get them using:
Set ObjGrid = Obj_WdwN.SwfTable("swfname:=ultraGridMantoMemoAlarma")ObjGrid.Highlight a = ObjGrid.Object.DisplayLayout.Bands.item(0).Columns.item(0).Key
or even when using
a = ObjGrid.GetNAProperty("DisplayLayout.Bands[0].Columns[0].Header.Caption")
but the thing is that when doing this (Bands[0].Columns[0].) it shows up the column name of the second column in the grid, I am not able to get the first column Key(Name)
Could you please let me know If I am misisng something in the code...or this is an application issue that it is not taking the first column into the grid...or so....
Thanks, I will appreciate your response.
Hello ,
Indexing of column collection is based on the order on which columns were added to the collection. Position of the column in UltraGrid is based on VisibleIndex property of column object, in common case VisibleIndex is the same as column index, but it is wrong to assume that this is so in every case. So in your case it seems that your columns were reordered and VisibleIndex is not the same as Column Index, so you should get your column by key instead by index:
a = ObjGrid.GetNAProperty("DisplayLayout.Bands[0].Columns[columnKey].Header.Caption")
I hope that this will helps you.
Thanks for clarifying
If you are interested in getting the first column in the visible order and you are not using RowLayouts (RowLayoutStyle == None), you could use theGetFirstVisibleCol method.
this.ultraGrid1.DisplayLayout.Bands[0].GetFirstVisibleCol(this.ultraGrid1.DisplayLayout.ColScrollRegions[0], true);