Skip to Content
0
May 14, 2016 at 06:22 PM

Load items in List on Pageload

367 Views

Hello SAPUI5 Community,

I'm relatively new to SAPUI5 and still have trouble understanding some of the concepts.

For starters i made a template Master Detail HTML5 Application and filled it with an OdataService like it is decribed in the various Tutorials.

It worked and now the HTML5 App shows me the Content of the "Products" Table.

I found out that i could use the basic Odata filter mechanisms by adding ?$filter=... to the items attribute (Is Attribute the right term?) in the html Code. If i added the Filter the List would show only the specified Items.

Now my Question is: On Pageload i want to change the items Attribute so that only specific Items are shown in the List.

My thought behind this is that i later want to make a Login and the User only gets Data from theOdata Service that belongs to him.

I added a line of Code to the onInit function in the Controller of the view to change the items Attribute but it didn't work.

When i do that then Chrome shows this Error.

Now is this a good approach or is it the complete wrong way to try to accomplish this task?

I'm a bit lost in the SAPUI5 Documentation and the different Functions of the List Class specified there are not well explained. I found more Methods like setItems() but I don't understand their explanation. Also the terms Aggregation and Model aren't clear to me and i haven't found an explanation.

I hope i made my train of thought clear and hope you can provide me with a general direction to help me get better with SAPUI5

Greetings,

Oliver

Attachments

example.PNG (36.8 kB)
coded.PNG (50.8 kB)
cod2.PNG (56.3 kB)
error.PNG (14.5 kB)