Skip to Content
0

Data retrieving from newly added table column on xml view

May 10, 2017 at 12:39 PM

65

avatar image

Hi Guys,

I created a simple list type SAPUI5 application. In which, Table data, which is retrieved through odata service, is getting displayed on screen. Now I added one more column through xml view which is actually a input date picker column. When a particular date is chosen in date picker column and press a button (created on xml view) and try to get table data in debugging mode then i get data of those columns which are a part of table itself but i couldn't get data from date picker input field column, which is added through xml view. Code for retrieving data is written below:

here inputDate is id of date picker column.

Did I miss any binding of column with model. Please suggest.Thanks in advance......

var oTable = this.getView().byId("tablegrid");

var oModel = oTable.getModel();

var aItems = oTable.getItems();

var oValuesBookingDate = [];

for( var p = 0; p < aItems.length ; p++) {

oValuesBookingDate[p] = oModel.getProperty("inputDate",aItems[p].getBindingContext());

}

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

2 Answers

Sharath M G May 10, 2017 at 01:20 PM
1

if you want the new field date, then firstly include that field into the model.

Then, bind the date property in the model to the column in the table.

Now, if you pull up the model, the date entered in the column will come to you.

If you don't want to extend the model, then try to look up the table cell and get the value in the cell.

Ex: for(int i=0; i<noOfRows; i++{this.byId("<Table ID>").getItems()[i].getCells()[i];}

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hi Sharath,

Can u suggest how to bind that column with model, if column id is "inputDate"?

and i was trying to get column data through the code :

this.byId("tablegrid").getItems()[0].getCells()[6]

here 6 is the column number of newly added column.

Regards

Sukhram Bhamboo

0

In the binding for the table, you would have used a model.

In that model, there are properties which are mapped to the existing table.

Now, include a new property date in the existing model.

Then, in the view definition of the table, bind the new property to the column input/date field.

Regards,

Sharath

0
Jun Wu May 10, 2017 at 03:36 PM
1

do you have binding for that new column?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Jun Wu,

Actually i simply added that column to table through xml view. I didn't bind that column. Can u suggest how to bind and where to bind?

Regards

Sukhram Bhamboo

0