Skip to Content
0

How to get values from table without clicking on the row?

Mar 23, 2017 at 11:29 AM

59

avatar image

Hi All,

I have to retrieve (array of values) values from table and use it for calculating purpose.

my view code:

<Table id="idcompallowancetable"

items="{/Added_AllowancesSet}" >

<columns id="idtablecomp">

<Column demandPopin="true">

<Label text="Allowances" design="Bold" />

</Column> <Column demandPopin="true">

<Label text="Amount" design="Bold"/>

</Column>

</columns>

<items>

<ColumnListItem>

<cells>

<Text text="{Subtype_Text}"/>

<Text text="{Betrg}"/>

</cells>

</ColumnListItem>

</items>

</Table>

"Betrg" - This is amount field.Totally 6 amounts will come.

I want to get those values and add up.

Please suggest me.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Akhilesh Upadhyay Mar 23, 2017 at 01:58 PM
0

you can get data from model itself if you are binding from model.

or, check below if it helps,

var oTableItems = oTable.getItems();
var totalAmt = 0;
for (var i = 0; i < oTableItems.length; i++) {
var rowAmount = this._oDataModel.getData(oTableItems[i].getBindingContext().getPath() + "/Betrg");
totalAmt = totalAmt + rowAmount; 
}
Share
10 |10000 characters needed characters left characters exceeded