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

Sub menu of check boxes

Hi team

I have created a dynamic menu of check boxes which gets its values from a DB table.
Can I create a dynamic sub menu for each initial menu item?
For example :
If someone checks Food, then I would like a sub menu of check boxes to appear so a selection is made.
I would like the whole structure to be populated from beginning.
I mean not to execute a new query every time user checks to go to a submenu.

Any other way to implement same functionality with checkboxes?

Thanks!
Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Sub menu of check boxes

Panagiotis,

Please fill in all the data from response to the page, and the data that should be hidden initially - hide. And when there is the value change of checkbox - show the desired data using js.

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

Sub menu of check boxes

Thanks

What about collapsableSet?
This is my main concern, how to put under each section the proper entries.

I have a table with two columns, one with first level menu text (menu) and another column (submenu) with submenus of each menu text.

I can populate the first level of collapsableSet, dynamically.
How do I put under each menu, the corresponding submenus ?
Is it possible with one query?

Thanks!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Sub menu of check boxes

Hello Panagiotis,

Could you please detail, each menu item in your sub menu can have multiple paragraphs? Could you please give an example of response service or an example (screenshot of a piece of) database for we could understand the structure?

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

Sub menu of check boxes

Image

What I would like to create is, a menu with submenus of checkboxes, which are created dynamically from a DB table.
I know and can create the top menu with a query service

What is the best way forward?
Use check boxes ?
Use collapsibleset ?

I can not find out how I can populate the sub menus from DB

Thanks!

(The picture is static)

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

Sub menu of check boxes

Hi Panagiotis,

You should use two-level rest service response.

Then you can make mapping for two levels of your components:

http://prntscr.com/4ggek8/direct

Also this thread could be helpful.

Regards.

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

Sub menu of check boxes

Thanks

Can I have the thread?
As I do not understand completely the two level rest service approach.
In your example what is friends[], what data does it holds?

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

Sub menu of check boxes

I figure it out.

In order for what you proposed to work, I need to create a column of type array in my DB for the SubMenu

Image

That woks fine.

Now I thought I can go another step and include in the array if the SubMenu will be visible or not by writing ["Drink@true"] and in the query service to to take one part for the text of the checkbox and the other part to make the checkbox, visible or not.
I thought of using split("@")
Can this be done in the mapping of the service ?

Image

The app as it is now it shows like this

Image

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

Sub menu of check boxes

Hi Panagiotis,

Yes, you understand it correctly in way to implement nested lists..

And yes it could be done with JS.

  1. For text value: Just click on "Text" property "JS" and populate it with following JS:

    pre

    var splited = value.split("@");

    //It will return first part (before @).
    return splited[0];

    /pre

  2. For visible value: Just click on "Visible" property "JS" and populate it with following JS:

    pre

    var splited = value.split("@");

    var isTrue = splited[1] == "true";

    return isTrue;

    /pre

    Regards.

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

Sub menu of check boxes

many thanks! got it.

By this approach I have the below spaces problem

Image

Can this be fixed, no to have spaces between?
The spaces appear when there is false in the array, like "Food2@false"
How I can prevent these entries to appear, in the where clause, else?

Thanks.

Return to “Issues”