Page 1 of 2

How do I add optgroups for SelectMenu component?

Posted: Tue Aug 11, 2015 9:40 pm
by A.W.H.

I would like to add the option of having an optgroup in my select menus (see http://api.jquerymobile.com/selectmenu/).

How do I add this functionality to my SelectMenus?

Image


How do I add optgroups for SelectMenu component?

Posted: Wed Aug 12, 2015 11:16 pm
by Pablo

Hello Ave!

You can always drag the HTML component into your pages and copy paste the code to see how it works.

Give it a try.

Happy Coding!


How do I add optgroups for SelectMenu component?

Posted: Sat Aug 15, 2015 4:14 am
by A.W.H.

I need to change the values to variables imported from the database. What's the code I can use in HTML to do so?


How do I add optgroups for SelectMenu component?

Posted: Sat Aug 15, 2015 4:47 am
by A.W.H.

@Max Katz - will you try and add this functionality?


How do I add optgroups for SelectMenu component?

Posted: Sat Aug 15, 2015 8:33 pm
by Serhii Kulibaba

Hello Ave,

You can add these components with JS code manually, without services. Please use append() method for such functionality.


How do I add optgroups for SelectMenu component?

Posted: Sat Aug 15, 2015 10:53 pm
by A.W.H.

Can I add JS code within an HTML blob? Also, what do you mean append? Can you give me a snippet of what you described?


How do I add optgroups for SelectMenu component?

Posted: Sun Aug 16, 2015 12:09 am
by A.W.H.

How do I pass data from database to custom HTML


How do I add optgroups for SelectMenu component?

Posted: Sun Aug 16, 2015 9:19 pm
by A.W.H.

?

i don't know how to get the data from my database and then loop it to optgroups in js/html (loop meaning loop over all entries in db to create a select item for each)


How do I add optgroups for SelectMenu component?

Posted: Mon Aug 17, 2015 3:38 pm
by Illya Stepanov

In such case this should be implemented with custom JS logic.

  1. Make a query request to your database.
  2. Get response data from your service.
  3. And append needed data to your html component:
    pre
    codeApperyio('your_html_component')&#46;append('<li><a>New item</a></li>');/code
    /pre

How do I add optgroups for SelectMenu component?

Posted: Tue Aug 18, 2015 2:06 am
by A.W.H.

I see.

Can you please show me the code how to make a query and get response data in javascript? This is the part I don't know. I only know how to get data from mapping.

Can you also please show me the code to input a variable into an append statement inside the string? Because from

"Apperyio('your_html_component').append('a rel="nofollow"New item/a');"

it appears like "append('a rel="nofollow"New item/a')" is a string and there is no way to insert a variable as argument to append.