A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

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

Pablo
Posts: 0
Joined: Thu Dec 25, 2014 4:29 pm

How do I add optgroups for SelectMenu component?

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!

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

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

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

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

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

How do I add optgroups for SelectMenu component?

Hello Ave,

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

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

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?

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

How do I pass data from database to custom HTML

A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

?

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)

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

How do I add optgroups for SelectMenu component?

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
A.W.H.
Posts: 0
Joined: Sat Jun 20, 2015 7:02 am

How do I add optgroups for SelectMenu component?

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.

Return to “Issues”