Gonzalo Nalbandian
Posts: 0
Joined: Wed Mar 18, 2015 6:10 pm

Help with collapsible set with list inside

Hello everyone,
I have the following scenario:
Several places that sell food (already at DB in Collection FoodPlace)
Each place sells different dishes. (already at DB in Collection Menus with a pointer column pointing to FoodPlace Collection).

What I am trying to achieve (without success) is to create a nested collapsible made by a collapsible per FoodPlace and inside of it, another collapsible with every dish sell by that specific FoodPlace.

i.e.:

FoodPlace Collection:

Name

---------

PlaceA
PlaceB

Menus Collection
FoodPlaceId Name Description

----------------------------------------

PlaceA -------Lasagna ----some decription
PlaceB -------Beaf ---------some decription

I need to populate nested colapsibles like this:

-PlaceA
--Lasagna
---Description

-PlaceB
--Beaf
---Description

Could yoy please give me a hand with this?
Thanks, regards.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Help with collapsible set with list inside

Hello Gonzalo,

You need to map services responses to components correctly.
Please check mapping doc https://devcenter.appery.io/documenta...

Try it first and let us know if you have specific question. Show what you have tried, screen shots will help.

Gonzalo Nalbandian
Posts: 0
Joined: Wed Mar 18, 2015 6:10 pm

Help with collapsible set with list inside

Hi, thanks for your answer.

I have created the following mapping structure
Image

But it is not working the way I intend to.
Image

I need two different main collapsibles, one per food place.
Inside of them, i need to populate them with a collapsible per food plate serving at that place.

My DB looks as follows:
Menus Collection
Image

FoodPlace Collection
Image

Any suggestion?

Gonzalo Nalbandian
Posts: 0
Joined: Wed Mar 18, 2015 6:10 pm

Help with collapsible set with list inside

Ok, have mapped the food collection correctly.
Now I need to map inside each collapsible, all the menus from that specific Restaurant.

This is the design view:
Image

And this, is the test view:
Image

I have no clue how to populate with menus the FoodPlaces collapsibles.
I think I should firstly, send a query with the FoodPlace Id (IdCarta) to retrieve all those menu for a specific Restaurant.

Could you please guide me through this.
Thanks!

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Help with collapsible set with list inside

Hello Gonzalo,

send a query with the FoodPlace Id (IdCarta) to retrieve all those menu for a specific Restaurant.

Yes, this is correct approach.
Assuming you have pointer you can easily make this by useing pointer id in the where query

Gonzalo Nalbandian
Posts: 0
Joined: Wed Mar 18, 2015 6:10 pm

Help with collapsible set with list inside

Hi Egor, I have done that using the following js statement at 'where' condition:

return '{"idCarta": {"$inQuery":{"NombreCarta":"'+value+'"}}}';

But for some reason I doesn't populate the collapsibles.

Value is mapped to the Text property of the main collapsible, that would be PlaceA and PlaceB

I have tested the service query specifying where as {"idCarta": {"$inQuery":{"NombreCarta":"PlaceA"}}} and I get the correct answer.

I don't know why it doesn't work with collapsibles. Maybe because the are dynamically created?

Thanks for reading.

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Help with collapsible set with list inside

Hello Gonzalo,

1) test if you have expected results in test tab for your service before using it
2) if #1 works fine, then check if result structure is the same as you have in result tab of this service
3) if #2 checked, then after service was called, navigate to console(console should be opened before calling service) and check if service returns expected result in network tab

Gonzalo Nalbandian
Posts: 0
Joined: Wed Mar 18, 2015 6:10 pm

Help with collapsible set with list inside

Hello Egor.

All three points checked correctly.

This is the response for PlaceA

[{"id":"5509a12ee4b015c39207f029","acl":{"":{"read":true,"write":true}},"createdAt":"2015-03-18 16:00:46.276","updatedAt":"2015-03-19 02:15:40.490","Nombre":"Suprema","Tickets":1.0,"idCarta":{"id":"55092c27e4b09359b1c0ec78","createdAt":"2015-03-18 07:41:27.298","updatedAt":"2015-03-19 12:48:12.514","Activo":true,"acl":{"":{"read":true,"write":true}},"NombreCarta":"PlaceA"},"Descripcion":"ccc"},{"id":"5509a9fde4b015c39207f04c","idCarta":{"id":"55092c27e4b09359b1c0ec78","createdAt":"2015-03-18 07:41:27.298","updatedAt":"2015-03-19 12:48:12.514","Activo":true,"acl":{"":{"read":true,"write":true}},"NombreCarta":"PlaceA"},"acl":{"":{"read":true,"write":true}},"createdAt":"2015-03-18 16:38:21.551","updatedAt":"2015-03-19 02:15:33.851","Nombre":"Milanesa","Tickets":1.0,"Descripcion":"aaa"}]

I have two services, one that list all the places where you can eat. This one works fine, and creates collapsibles PlaceA and PlaceB. The second service is a query to the menus of each restaurant, which is called after the previous service call finishes.

But for some unknown issue, the collapsible doesn't get popullated.
What else can I try, o what else I can provide to you for solving this out.

Thanks, regards.
Gonzalo Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Help with collapsible set with list inside

Hi Gonzalo,

I'm sorry but you can not populate nested list with two-or-more services. You should have just one service with nested response.

Here is a solution for two level nested list. Also you can improve it to x-level like you need.

At first you need to create two level service.

Please use for these goals "Generic service". You should to implement service manualy in accordance with your needs.

Take a look how to implement generic service in appery.io: http://docs.appery.io/documentation/u...

Note: your own generic service should return two-level array.

Secondly(when you will have two-level response service):
1 put first-level grid on the page.
2 put second-level grid in the first-level grid. http://prntscr.com/4ggd8z/direct
3 navigate to "data" page mode and add your two-level service to the page.
4 Click "Edit mapping".
5 Create two-level mapping like on screen shot: http://prntscr.com/4ggek8/direct
6 Invoke this datasource on the "page show" event.

Also, you may consider to use "Server code" to return multilevel response with single request. (it could dramatically speed up your app).
More details about server code: https://devcenter.appery.io/documenta...

Regards.

Takis
Posts: 0
Joined: Wed Oct 22, 2014 5:10 pm

Help with collapsible set with list inside

Dear team

Can you please update this thread with documentation links that work?
Many people are asking about building a two level menu.

Please assist

Return to “Issues”