cancel
Showing results for 
Search instead for 
Did you mean: 

Element binding by attribute (for example ID) possible?

dominik_auras
Participant
0 Kudos

Hi,

it's possible to bind a view to the data via an index:


this.getView().bindElement("EntitySet>/entity/23");

But it is also possible to bind it to the data via a specific attribute?

Something like this:


this.getView().bindElement("EntitySet>/entity('id=12')";

I think i saw something similar somewhere ...

Would be great!

Regards,

Dominik

Accepted Solutions (0)

Answers (2)

Answers (2)

dominik_auras
Participant
0 Kudos

Ok, because I haven't solved it I've now rebuilt my application and split the data into two models.

One with the actual data that i want to display and a second (if requested) with the other data.

maartenf
Participant
0 Kudos

Hi Dominik,

Your syntax is correct and will work.

Little side note: You don't specify the entityset before the '>', you'll have to specify the model you want to bind to the view (although if you added the model with key 'entitySet', this will work ). Also refer to SAPUI5 SDK - Demo Kit - Data Binding

Best regards,

Maarten

dominik_auras
Participant
0 Kudos

Hi Maarten,

yes,I also think that it's right but it does not work.


Isn't there a documentation that explains exactly this?

Can't find anything.

Thanks and regards,

Dominik

maartenf
Participant
0 Kudos

Hi Dominik,

Refer to this blog: (it doesn't matter what type of model you are using, this example is with 2 ODataModels)

Best regards,

Maarten

dominik_auras
Participant
0 Kudos

Hi Maarten,

thanks for the link!

But unfortunately this solves not my problem that the binding via ID is not working

Still have the problem that binding via line number works and via attribute not...

Kind regards,

Dominik

maartenf
Participant
0 Kudos

Hi Dominik,

Which type of model are you using? I mostly work with ODataModel buth maybe there is a difference when using other models...

Best regards,

Maarten

dominik_auras
Participant
0 Kudos

Hi Maarten,

in case of testing/building my UI I use JSONmodel from a .json file.

Later I want to replace it with ODataModel received from NW Gateway.

Regards,

Dominik