Forum Discussion

ChrisMac's avatar
ChrisMac
Contributor
13 years ago

False row count on a grid using the object spy

Hello -

I've got an Infragistics grid that normally has 20 rows but I can filter that grid by checking a certain checkbox. After I check the checkbox, visually there are now 9 rows displayed but the Object Spy row count property is still 20. Apparently TestComplete is going to a deeper layer to do the row count and is still counting all 20 rows even though 14 are displayed. Has anyone else run into this and/or know of a solution?



Chris

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I don't know the specific control, but I know I've seen some controls that the row count is static based upon the number of data rows but the number of VISIBLE rows is variable.  There is an attribute or property on the row that says "visible" and is set to false.  The row still exists and contributes to RowCount, but the row itself is not visible.



    Some things to look for:



    1) a VisibleRows property

    2) When looking at individual rows, look for a "visible" property.
  • Ah-ha! Thanks Robert. There is a property called 'Rows' and when I click on the ellipsis button for 'Rows' a list of sub-properties is revealed, one of which is 'VisibleRowCount' whose value is  the correct number of visible rows, which in this case is 12.



    I'm half-way there. I am using the value of 12 in a For loop so I now have the correct number of iterations but TC is still grabbing the values of rows that aren't visible. Normally I would use wValue to get the value of a cell in the grid  but for this scenario I would need a method like 'wVisibleValue' which would grab the value of a cell in only the rows that are visible. I'm going to experiment with different methods but in the mean time if anyone has any suggestions.....



    Chris

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    The 12 in the ForLoop will still iterate through both visible and invisible rows.  Again, not knowing the object, but if you get a "Row" object itself (not the Rows property, but an individual object), can you see if there are properties on that which indicate visible?  If so, you might want to iterate through wRowCount and only interact when Row.Visible = true.