Forum Discussion

Adagio's avatar
Adagio
Frequent Contributor
7 years ago

Fetch rows and column values from a custom built table in AngularJS web application

Hello,

 

I'm trying to read the rows and columns of a custom built table in an Application. This is a dynamic table and the number of rows keep increasing or decreasing based on certain actions. I'm trying to read the first column of the last row in the table and for that I tried using the object spy. here the object recognizes each of the rows in  the first column as Cell(0,0). I'm not able to come up with any unique way to identify the newly added rows. 

 

Also, I checked for the unique properties, but I don't see any which would identify the cell as unique.

 

I also tried looking at other such questions posted on the community, but nothing helped so far. 

 

any help would be greatly appreciated

 

Thank you

Abhi

14 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    If you are finding the "Cell" within the table, then it should respond to standard table properties.  This means your table object should have a RowCount property.

     

    So, if you want to read the first column of the last row, you should do something like this:

     

    tableObject.Cell(tableObject.RowCount-1, 0)

     

    EDIT: Since your table is dynamic in rows, the above method is the recommended method for getting to any particular cell.  Mapping the cell will not get you what you want since that first number will be changing every time.  When it comes to dynamically generated content like this, it's best to map the parent object (in this case, the table) and use code expressions like what I've noted to get to individual cells. 

    • Adagio's avatar
      Adagio
      Frequent Contributor

      Thanks Robert

       

      As I explained in my post that no matter which row I'm looking at every cell in the first column is mapped as Cell(0,0) so RowCount doesn't help here. for more Info please have a look at this one: ColumnIndex and RowIndex is always set to 0

       

       

      Thank you

      Abhi

      • shankar_r's avatar
        shankar_r
        Community Hero

        Instead of mapping unique cells, If you know what entry[one unique column value is enough] is going to add it your table, then you find them with the expected values and see whether those entry got reflected in table or not.

         

        If you are not sure what values going to add, You can't validate it right way but you can validate with assumption that it is inserting it lastrow.

    • sriram_sig's avatar
      sriram_sig
      Contributor

      when i try to retrieve value from the cell using - 

      tableObject.Cell(tableObject.RowCount-1, 0)

      I'm getting an error object not callable. Do you know how this can be resolved?