cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 factory function OData

Dogan
Participant
0 Kudos
204

Hi guys,

i am using a factory function with grid, but always get an undefined error.

This is what my view looks like:

<layout:Grid
id="grid2" defaultSpan="XL12 L12 M12 S12" class="sapUiSmallMarginTop" content="{ path: '/QuestionCatalog', templateShareable: true, factory: '.gridFactoryFunction'}" > </layout:Grid>

And here is my controller:

gridFactoryFunction: function (sId, oContext) {

var oUIControl;

if(oContext.getProperty("answerType") === "Dropdown") {

oUIControl = new sap.ui.xmlfragment(sId,"myapp.view.fragments.GridDropdown", this);

} else if (oContext.getProperty("answerType") === "RadioButton") {

oUIControl = new sap.ui.xmlfragment(sId,"myapp.view.fragments.GridRadioButton", this);

}

return oUIControl;

}

Basically i have my entity QuestionCatalog where all my questions are saved and based on the answerType either a Dropdown or a Radio Button is displayed.

But i always get this error:

Also my entity starts with a weird number first and after that i get my real first data.

The first "value" i get is always /QuestionCatalog/-9007199254740991 (which probably leades to the undefined error).

After that it continues normally with /QuestionCatalog(ID=1)

What can i do to avoid the error?

Can i skip that weird entry, because the data in my Odata looks normal:

{

"@odata.context": "$metadata#QuestionCatalog",

"value": [

{

"ID": 1,

"question": "First question",

"answerType": "Dropdown"

},

{

"ID": 2,

"questionnaireGroup_code": "AA",

"question": "Second question",

"answerType": "RadioButton"

}


Accepted Solutions (0)

Answers (0)