cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5: Uncaught TypeError: c.getPath is not a function

Former Member
0 Kudos

Hello Experts,

I try to bind data in an array to a list and table as in 10 SAP exercise document

However, I face the issue Uncaught TypeError: c.getPath is not a function and No data is found on either the list or table. Any idea is appreciated. Thank you very much.

My xml code


<ObjectHeader title="{MaterialId}">
<attributes>
<ObjectAttribute text="{Name}" />    //it binds successfully
</attributes>
</ObjectHeader>

<List id="classList" mode="{device>/listMode}" itemPress="handleListSelect" items="{Classification}"> //no data found
<ObjectListItem type="Active" press="handleListItemPress" title="{ClassId}">
</ObjectListItem>
</List>
 

My navigate and binding code


var context = evt.getParameter("listItem").getBindingContext().getObject();
  this.nav.to("MaterialDetail", context);
 

/////

var page = app.getPage(pageId);

  console.log(context);

  page.setBindingContext(context);

My context:

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

If you send object you may can't bind with the path try like this,

var context = evt.getParameter("listItem").getBindingContext();


this thread may help you,

Answers (3)

Answers (3)

former_member182372
Active Contributor
0 Kudos

But you are doing

var context = evt.getParameter("listItem").getBindingContext().getObject();

just do


var context = evt.getParameter("listItem").getBindingContext();


object is not a context, context is Path+Model

sandroramos
Active Participant
0 Kudos

Hi,

Change items="{Classification}" to items="{/Classification}" in List definition.

So, it could be like this:


<List id="classList" mode="{device>/listMode}" itemPress="handleListSelect" items="{/Classification}">
     <ObjectListItem type="Active" press="handleListItemPress" title="{ClassId}" />
</List>

Regards,

Sandro Ramos

Former Member
0 Kudos

I changed it as u suggested but i does not work Sandro. I suspect that my path is not correct but i dont know how to change it.

Private_Member_15166
Active Contributor
0 Kudos

Perhaps you are using eclipse for development. And you have made error while pressing CTRL+C. When you have pressed CTRL+C at that time the copied data might has been replaced by c and now it's become c.getPath

See your whole code where you have used getPath method.

If this is not the case then post your code where you have used getPath method.

Regards

Dhananjay