B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

How to create appery control dynamically

I need to load control names from REST then create them then show them on appery page, any example for doing this?
For example:
I got result below from REST

Type: Textbox
Name: _txt01

Type: Listbox
Name: _lb01

Then a textbox and listbox would shown on my appery page.

Please help

Thanks & Regards
Win

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

How to create appery control dynamically

Hello,

Please use a service mapping for that: https://docs.appery.io/docs/appbuilde...

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

How to create appery control dynamically

Hi Sergiy,

but how to create controls (ie. textbox, label, listbox etc) when mapping?

please help

B5107656409
Posts: 0
Joined: Thu Jul 23, 2015 6:39 am

How to create appery control dynamically

I meant the page is empty before calliing the REST .. and create controls (label, textbox, listbox, combobox.. etc) when mapping..

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

How to create appery control dynamically

You have to put them to the wrapper component (grid, HTML, list). After that if you add a mapping to that wrapper you'll get a list of grids with all it's children elements

Fabio Primerano
Posts: 0
Joined: Sat Apr 21, 2018 9:39 pm

How to create appery control dynamically

Hi Serhii,

but if I need to use an "HTML wrapper", where inside I need to create the different component, I do not see these component in the mapping.
I see only "HTML code" and "Visible" options.
Here is a picture Image

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

How to create appery control dynamically

Please see the screenshot below:

Image

  1. The component "html_1" has the custom HTML layout.
    1.1 It is not possible to set the value of that layout with the mapping, but you can set it with the custom JS code.
    1.2 Just add the JS code to the mapping of that HTML component. The current element is available in the variable "element", so if you have a button in your custom layout and you need to change it's value, just use a JS code like:
    pre$(element).find("button").text("hello");/pre

  2. The component "html_2" has a type=div and the button was added with the Appery.io Visual editor to that component, so you can use the mapping there without problems

Return to “Issues”