Skip to Content

How to read invisible table row data in sapui5

Dear Friends,

In my scenario, my table is having more than 10 records, but visible rows are 10. So I am able to read the data upto 10th row.But from 11th  loop count, error is thrown as "Uncaught TypeError: Cannot read property 'getCells' of undefined"  in the below code.

var cells = rows[i].getCells();

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 09, 2015 at 11:33 AM

    what about reading your model data?

    Or why do you need to read the cells?

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 12, 2015 at 10:23 AM

    Dear Kai,

    I am sorry if I have mentioned anything wrong.

    Also I have JavaScript Knowledge.I have mentioned my requirement clearly.Please read the question.

    My code is here below:

    for(var i=0;i<length;i++){


       // var cells = rows[i].getCells();


       var ctx=otab.getContextByIndex(i);


               if( ctx.getProperty("Belnr") != ''){

            //if(otab.getModel().getData().results[i].Belnr != ''){ 

        var invoice = ctx.getProperty("Belnr");                  //cells[0].getText();

        var delive  = ctx.getProperty("Delivery");              //cells[1].getText();

        var item    = ctx.getProperty("ItemNo");                //cells[2].getText();

        var Matnr   = ctx.getProperty("Matnr");                 //cells[3].getText();

        var SsdId   = ctx.getProperty("SsdId");                 //cells[5].getText();

        var total   = ctx.getProperty("Qty");                      //cells[6].getText();

        var rtotal  = ctx.getProperty("ReceivedQty");        //cells[7].getValue();



    My last field is editable,i.e. ReceivedQty. So I cannot take the model data directly.I just need to read the invisible rows in the page.

    Kindly be specific and if u have answer Please share.

    Add comment
    10|10000 characters needed characters exceeded

    • As Kai and Dennis have mentioned, you should loop over the model data, and not the table rows/cells. If ReceivedQty is not part of your model data, then it should be made part of it 😊

      As a rule of thumb, there is never, and there will never be, a proper usecase for using the table.getRows() or table.getCells() methods. IMHO, these methods should be made deprecated or at least protected