on 01-09-2015 11:05 AM
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();
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();
child.push({Belnr:invoice,Delivery:delive,ItemNo:item,Matnr:Matnr,SsdId:SsdId,Qty:total,ReceivedQty:rtotal});
}
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
what about reading your model data?
Or why do you need to read the cells?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm sry but I think this is too much...
Learn JavaScript before asking after such simple tasks.
With getData() you will get the whole data object. Analyze it with developer tools and google for looping over such data objects. You'll find also a lot good stuff in this SCN space.
Just search a little bit.
Also please mark Dennis Seah's answer as correct.
Thank you.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.