Forum Discussion

vadaliprasad's avatar
vadaliprasad
Occasional Contributor
14 years ago

Selecting multiple items of an AdvanceDataGrid

With the help provided, I could select an item of an advanced data grid, using the following code:

sub Test




set Context1 = sys.process("firefox").Page("*")



propNames = Array("ObjectLabel", "ObjectType")


propValues = Array("Properties...","UserFoldersSetPermissionsPopup")


set objSetproperties = Context1.FindChild(propNames,propValues, 6)


if objSetproperties.exists then


log.Message "Set Properties panel is open"


'logic to multi-select the options

' propNames = Array("ObjectLabel", "ObjectType")


' propValues = Array("ACC-system-admin","AdvancedDataGridItemRenderer")


' set objAdmingroup = objSetproperties.FindChild(propNames,propValues, 6)


' objAdmingroup.click


' delay 2000


' propNames = Array("ObjectLabel", "ObjectType")


' propValues = Array("ACC-AppleSeeds-Group","AdvancedDataGridItemRenderer")


' set objAvongroup = objSetproperties.FindChild(propNames,propValues, 6)


'


' objAvongroup.click(skCtrl)


' delay 2000



propNames = Array("ObjectLabel", "ObjectType")


propValues = Array("userGroups","SelectionAdvanceDataGrid")


set objdgrid = objSetproperties.Scroller(0).Scroller(0).SelectionAdvanceDataGrid("userGroups")


if objdgrid.exists then


log.Message "Datagrid found"


rowCnt = objdgrid.FlexObject.dataProvider.length


log.Message rowCnt


rowIndex = 1


rowIndex2 = 2


'Sys.Desktop.KeyDown VK_SHIFT


'Sys.Desktop.KeyDown(Win32API.VK_CONTROL)


 


objdgrid.FlexObject.selectedIndex = rowIndex


set opObj = objdgrid.FlexObject


delay 2000


'opObj.keys "[^]"


 


Call LLPlayer.KeyDown(VK_SHIFT, 2000)


'objdgrid.keys "[^]"


'call sys.Keys


 


delay 2000


objdgrid.FlexObject.selectedIndex = rowIndex2


'onscreenObj.Keys "^[Esc]"


Call LLPlayer.KeyUp(VK_SHIFT, 2000)


'Call LLPlayer.KeyUp(VK_SHIFT, 2000)


'Sys.Desktop.KeyUp VK_SHIFT


'Sys.Desktop.KeyUp(Win32API.VK_CONTROL)


'rowIndex = wGrid.FlexObject.selectedIndex


'opObj.keys micLCtrlUp


propNames = Array("Caption", "ObjectType")


propValues = Array("Submit","Button")


set objSubmitbutton = propertiesPopup.FindChild(propNames,propValues, 5)


objSubmitbutton.click


'Call LLPlayer.KeyUp(VK_SHIFT, 2000)


 


else


log.Message "Datagrid Not found"


end if


 


 


else


log.Error "Set Properties panel failed to open"


end if








As per the testcase, it is required to select multiple items. As seen from the commented code, I have tried numerous ways to attain multi-selection. Please suggest any approach to select multiple items of an advance datagrid.

1 Reply

  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Prasad,


    Unfortunately, TestComplete doesn't provide any extended methods and properties for automating Flex AdvancedDataGrid, but you might be able to perform the needed actions with the grid's native methods and properties. You can access these native methods and properties in the Object Spy and your tests via the grid's FlexObject property. To see an example of how the native methods are used in tests, please refer to the Work with AdvancedDataGrid How To entry.


    BTW, you can submit a feature request for the extended AdvancedDataGrid support here, and if it gets enough votes, the TestComplete team will consider adding it to the roadmap for future versions.


    I hope this information helps :)