Skip to Content
0

OData Service - Syntax for calling two or more associated Child-Entitys via Expand

Jul 05, 2017 at 10:41 AM

51

avatar image

Hey Guys,

i tried to bind a Serivce-Entity with its children entity to my detail view.

Like this:

	_bindView: function(sObjectPath) {
			
			var oViewModel = this.getModel("positionView"),
				oDataModel = this.getModel();


			this.getView().bindElement({
				path: sObjectPath,
				parameters: {
					expand: 'ToPurchase'
				},

And it works, after calling the GET_ENTITY Method from the father the GET_ENTITY of the child was called to.

But now i would like to call and bind the secound child-service to the view. But i didnt know the specific syntax to call via the expand parameter in JavaScript 2 or more childs.

Something like this:

_bindView: function(sObjectPath) {
			
			var oViewModel = this.getModel("positionView"),
				oDataModel = this.getModel();
			this.getView().bindElement({
				path: sObjectPath,
				parameters: {
					expand: 'ToPurchase', 'ToTransport'
				},

Is this possible and know somebody the correct syntax?

Thank you!

Best Regards

Patrick

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

2 Answers

Best Answer
VIPLOVE KHUSHALANI Jul 05, 2017 at 11:37 AM
0

Hi Patrick Gutting,

one thing is you can bind the element separately to the controls instead of binding both to the view or if you want to bind it to the view than bind it two times , not in one bindElement statement

this.getView().bindElement({
				path: sObjectPath,parameters:{expand:'ToPurchase'},..
this.getView().bindElement({
				path: sObjectPath,parameters:{expand:'ToTransport'},..

Thanks

Viplove

Share
10 |10000 characters needed characters left characters exceeded
Patrick Gutting Jul 12, 2017 at 09:00 AM
1

Hi Viplove,

thanks for your response i have resolved the problem as follows: Sometimes its so simple, just separate by a comma within the same string.

this.getView().bindElement({
         path: sObjectPath,
         // bind children data
         parameters: {
           expand: 'ToVoyage,ToTransport'
         },

Best regards,

Patrick

Share
10 |10000 characters needed characters left characters exceeded