Forum Discussion

anuragrbl's avatar
anuragrbl
Occasional Contributor
24 days ago

How can we fetch ColumnIndex based on Column Name for Syncfusion Grid Control in Python

I was following below page for reference but didn't get also do we have more clear documentation for Syncfusion control ?

https://support.smartbear.com/testcomplete/docs/app-objects/specific-tasks/grids/syncfusion-grid-control/index.html

8 Replies

  • Marsha_R's avatar
    Marsha_R
    Icon for Champion Level 3 rankChampion Level 3

    Did you check the sections at the bottom of that page? They all have examples of code to do different things.

     

  • anuragrbl's avatar
    anuragrbl
    Occasional Contributor

    I checked but i haven't seen any method related to fetch column index.

    • Marsha_R's avatar
      Marsha_R
      Icon for Champion Level 3 rankChampion Level 3

      Can you use Object Spy on one of the cells and let us see the properties?

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    Can you provide a screenshot of the Object Spy tool, with the properties of your grid control?

  • Hassan_Ballan's avatar
    Hassan_Ballan
    Icon for Champion Level 1 rankChampion Level 1

    In concept web page table should not be too different from Windows forms table, and following this example you should be able to manipulate it. You only need to figure out your available similar properties for ColumnIndex and RowIndex. 

    Access https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_intro 

    On Project level variables add the following string variables:
    ColumnName
    ColumnIndex
    RowIndex

    In NameMapping map the following nodes under NameMapping.Sys.browser.pageW3schoolsTryitEditor.frameIframeresult
    column with XPath=//th[.='%ColumnName%']
    row with XPath=//tr[%RowIndex%]/td[%ColumnIndex%]

    Now you can test it with this code, modify the ColumnName and RowIndex to your choosing

    def Test1():
        Var1 = 0
        Browsers.Item[btChrome].Run("https://www.w3schools.com/html/tryit.asp?filename=tryhtml_table_intro")
        Aliases.browser.pageW3schoolsTryitEditor.Wait()
        Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.RefreshMappingInfo()
        Project.Variables.ColumnName = "Contact"
        Project.Variables.RowIndex = "3"
        Var1 = Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.column.ColumnIndex
        Project.Variables.ColumnIndex = Var1 + 1
        Log.Message(Aliases.browser.pageW3schoolsTryitEditor.frameIframeresult.row.contentText, "")

    P.S. if you like my post give a like, and if it solved your problem mark it as solution to give credit.

  • anuragrbl's avatar
    anuragrbl
    Occasional Contributor

    I am not trying for webtable, its is for winform using custom control of Syncfusion.

    • rraghvani's avatar
      rraghvani
      Icon for Champion Level 3 rankChampion Level 3

      Can you provide a screenshot of the Object Spy tool, with the properties of your grid control?

    • Hassan_Ballan's avatar
      Hassan_Ballan
      Icon for Champion Level 1 rankChampion Level 1

      I know that you are using a desktop application and looking at Winform using Sysfunction custom control. I thought maybe if I show you how I went about it using a common-ground web table I could help you implement something similar. Surely there would be some commonalities in concept between windows and web tables.

      Both rraghvani and marsha_r asked you provide screenshot of the object spy displaying the grid control properties. We can not help you if you don't provide feedback with details.