Page 1 of 2

Help with collapsible set with list inside

Posted: Wed Mar 18, 2015 6:10 pm
by Gonzalo Nalbandian

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.


Help with collapsible set with list inside

Posted: Thu Mar 19, 2015 9:20 am
by Alena Prykhodko

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.


Help with collapsible set with list inside

Posted: Thu Mar 19, 2015 12:56 pm
by Gonzalo Nalbandian

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?


Help with collapsible set with list inside

Posted: Mon Mar 23, 2015 10:32 pm
by Gonzalo Nalbandian

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!


Help with collapsible set with list inside

Posted: Thu Mar 26, 2015 9:58 pm
by Egor Kotov6832188

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


Help with collapsible set with list inside

Posted: Fri Mar 27, 2015 2:48 am
by Gonzalo Nalbandian

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.


Help with collapsible set with list inside

Posted: Sun Mar 29, 2015 9:04 pm
by Egor Kotov6832188

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


Help with collapsible set with list inside

Posted: Mon Apr 06, 2015 2:15 pm
by Gonzalo Nalbandian

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


Help with collapsible set with list inside

Posted: Tue Apr 07, 2015 10:39 pm
by Yurii Orishchuk

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.


Help with collapsible set with list inside

Posted: Thu Nov 10, 2016 1:55 pm
by Takis

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