Page 1 of 1

How to create appery control dynamically

Posted: Sat Aug 20, 2016 9:53 am
by B5107656409

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


How to create appery control dynamically

Posted: Sat Aug 20, 2016 11:13 am
by Serhii Kulibaba

Hello,

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


How to create appery control dynamically

Posted: Sat Aug 20, 2016 11:24 am
by B5107656409

Hi Sergiy,

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

please help


How to create appery control dynamically

Posted: Sat Aug 20, 2016 11:34 am
by B5107656409

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


How to create appery control dynamically

Posted: Sun Aug 21, 2016 7:49 am
by Serhii Kulibaba

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


How to create appery control dynamically

Posted: Wed Jul 18, 2018 5:39 pm
by Fabio Primerano

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


How to create appery control dynamically

Posted: Mon Jul 23, 2018 1:05 pm
by Serhii Kulibaba

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