on 05-18-2014 7:04 AM
Hi,
My requirement is to read all data from the table by clicking on the Button. Using the below code we are trying to read all rows in the table.
var oTable = new sap.ui.table.Table({
title: "",
id: "datatable",
visibleRowCount: 5,
width: "400px",
firstVisibleRow: 3,
editable: true,
});
var bttn= new sap.ui.commons.Button({
text : "Read Data",
tooltip : "This is a test tooltip",
press : function() {
for(var i=0;i<oTable.getRows().length;i++)
{
alert(oTable.getRows()[oTable.getSelectedIndices()[i]].getCells()[1].getText()); // i am unable to display the data at this statement
}
}
});
Pls suggest...............
Is the table bind to a model?
-D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mano,
getSelectedIndices() will return an array of rows which are selected. Not all the rows.
You could instead try this :
oTable.getRows()[i].getCells()[1].getText()
Thanks and best regards,
Shilpa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mano
This syntax will get you all the rows in the table. Do you want all the rows or selected one only please clarify clearly
sap.ui.getCore().getElementById('T-POhdr-DR').getRows()
Nabheet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
The code oTable.getRows()[1].getCells()[1].getText(); is not working.
The above code is working only upto oTable.getRows()[1].getCells()[1] but if i put getText it is showing blank screen.
Event tried sap.ui.getCore().getElementById('T-POhdr-DR').getRows() but it is not working.
blank screen.
Pls suggest
Thanks
Mano
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.