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.
Unfortunately, activation email could not send to your email. Please try again.

How to manage Row Index in GridGroupingControl?

 

GridGroupingControl control is not row index based grid. The ideal way to tackle this is to rely on the displayed elements.

This sample script replaces the GreatGrandChildName26 to MyName, refer to the screen shot of the replay below with explanation of each element till the modified record.

VB

 

SwfWindow("GridGroupingControl").Move 347,344

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 5,"parentID"

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 5

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 10,"childID"

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 10

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCurrentCell 15,"grandChildID"

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").ExpandRecord 15

tablename = SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetTableNameByLevel(3)

colIndex = 2

colname = SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetColumnName(tablename, colIndex)

SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").SetCellData 19, colname, "MyName"

Screenshot of the replayed sample with notes of each element. This sample can be referred in Essential TestStudio\Examples\Samples\bin\2.0\Grid\GGC_Hierarchical.exe

The helper function GetRowElement can also be used to know the kind of the element behind the row.

VB

 

For row = 1 To SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetRowCount() -1 Step 1

    MsgBox SwfWindow("GridGroupingControl").SwfObject("gridGroupingControl1").GetRowElement(row)

Next

Article ID: Published Date: Last Revised Date: Platform: Control:
2359 04/30/2011 07/10/2014 Windows Forms QTP Add-On
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.