cancel
Showing results for 
Search instead for 
Did you mean: 

Table Binding Repeat Rows

Former Member
0 Kudos

I have a table bound to a Gateway service. The service returns the values I want, but in UI5 the table repeats rows and doesn't iterate through the results that the service returns. When first loaded, the entire table shows the same row. It will change to a new row when scrolled, but it's quirky.

Here is one of the columns of the table:

var oTable = new sap.ui.table.Table({

          visibleRowCount: 20,

          firstVisibleRow: 0,

          selectionMode : sap.ui.table.SelectionMode.None

});

oTable.addColumn(new sap.ui.table.Column({

          label : new sap.ui.commons.Label({

                    text : "Field"

          }),

          template : new sap.ui.commons.TextView({

                    text : "{Ftext}"

          })

}));

And here is the binding:

var sUrl = "/sap/opu/odata/sap/Z_RG7_SRV/";

var oModel = new sap.ui.model.odata.ODataModel(sUrl);

oTable.setModel(oModel);

var oFilter = new sap.ui.model.Filter("Objectid", sap.ui.model.FilterOperator.EQ, "8000000215");

oTable.bindRows("/ChangeLogSet", null, null, [oFilter]);

Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ryan,

You have to do bindProperty in the template you are using.

  1. oTable.addColumn(new sap.ui.table.Column({ 
  2.           label : new sap.ui.commons.Label({ 
  3.                     text : "Field" 
  4.           }), 
  5.           template : new sap.ui.commons.TextView({ 
  6.                     text : "{Ftext}" 
  7.           }).bindProperty("text","property_name")
Former Member
0 Kudos

Hi Sharique,

Putting {Ftext} as the value of the text attribute (text: "{Ftext}") does the same thing. Ftext is the name of the value coming from the service (https://sapui5.hana.ondemand.com/sdk/docs/guide/BindingAggregations.html).

In any case, using either produces the same results.

Former Member
0 Kudos

Hi Ryan,

If Ftext is the property of the gateway service then you can do this,

  1. oTable.addColumn(new sap.ui.table.Column({
  2.           label : new sap.ui.commons.Label({
  3.                     text : "Field"
  4.           }),
  5.           template : new sap.ui.commons.TextView().bindProperty("text","Ftext ")
Former Member
0 Kudos

Yes, but that does not change the results. It is just another way to produce the same thing I had with the original code.

Any other ideas?

Former Member
0 Kudos

Hi Ryan.

I've had the same issue. It turned out that the problem relates to the keys in the entity I used for a Gateway service. I'll try to explain on my example.

I had an entity with for fields: ID, pernr, name, text. At first the only key field was ID. When the service had to return the following rows:

ID     pernr     name          text

1      123         name1       text1

1       234        name2       text2

In the table two duplicates on the first row were show though when testing the service both rows were returned.

So I add marked pernr as the second key and that helped.

Former Member
0 Kudos

Yeah, that's the issue. Unfortunately my data model is built from a structure and there are no keys, but I'll figure that out. Thanks for your help.

gopi_nidjelli2
Participant
0 Kudos

Hi Illya,

         I had the same issue and see that after putting the second key it works fine. But when I navigate to the second screen, I am getting Invalid key predicate error.

Any suggestions?

Thanks

Gopi

Answers (0)