anon-3
April 24, 2018, 2:19am
1
This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal .
Is there a way to add components programmatically to a flexcontainer?
Something like: formName.flexcontainer.add(component)???
anon-4
April 24, 2018, 2:49am
2
Hi @Emewson Pvwkew ,
In Kony Reference Architecture : this.view.add(component).
In Free Form JavaScript : formName.flexcontainer.add(component).
Thanks
anon-4
April 24, 2018, 2:51am
3
hi, thanx! so add also works for components.
Do you know if it needs to be: formName.flexcontainer.add(namespace.name) or just name?
anon-4
April 24, 2018, 3:11am
4
Hi @Emewson Pvwkew,
Sample Code using Tabs component:
var tabs = new com.konymp.tabstextline(
{
"clipBounds":true,
"id": "tabstextline",
"isVisible": true,
"zIndex": 1
}, {}, {});
Form1.flx.add(tabs);
Thanks
anon-4
April 25, 2018, 2:14am
6
@Bevtwiz Cvmpxell Samanthapudi Do you also know how to reach a widget that is inside the component after adding it?
I have a component without a contract which has a textbox inside it (mine is called: txtInputText).
I tried:
var numerictext = new inputfields.textnumeric(
{
"clipBounds":true,
"id": "textnumeric",
"isVisible": true,
"zIndex": 1,
"top": "12dp",
"width": "96%",
"centerX": "50%"
}, {}, {});
frmComponent.flcContain.add(numerictext);
and then:
frmComponent.flcContain.textnumeric.txtInputText.text = "12";
but i get an undefined error trying to set the text property.
anon-4
April 25, 2018, 2:39am
7
Hi @Emewson Pvwkew ,
Code which you have shared is correct. Please check the id of the textbox is "txtInputText" in the component.
Thank
anon-4
April 25, 2018, 3:33am
8
Hi @Bevtwiz Cvmpxell Samanthapudi ,
id seems correct. Check out my screenshot.
Any ideas?**Image removed for security reasons**
anon-4
April 25, 2018, 7:58pm
9
Hi @Emewson Pvwkew ,
I have tried to replicate the same scenario. It is working fine for me.
If possible can you please share your project.
Thanks
anon-4
April 25, 2018, 8:06pm
10
Hi,
Yes I can share my project. Do you have anywhere i can upload it. It is 60mb.
anon-4
April 25, 2018, 8:11pm
11
@Bevtwiz Cvmpxell Samanthapudi It was smaller then i thought only 32 mb.
Here it is.
anon-4
April 25, 2018, 10:05pm
12
Hi @Emewson Pvwkew ,
Try providing properties like skin, masterType.
var sample = new com.test.sample({
"clipBounds": true,
"height": "100%",
"id": "sample",
"isVisible": true,
"layoutType": kony.flex.FREE_FORM,
"left": "7dp",
"masterType": constants.MASTER_TYPE_USERWIDGET,
"skin": "slFbox",
"top": "120dp",
"width": "100%",
"zIndex": 1
}, {}, {});
Above is the exact generate code when any component is added to form. You can check the same at <Workspace>\><projectName>\jssrc\<platform>\generated\<form to which component is added.js>
Thank you
anon-4
April 25, 2018, 10:27pm
13
@Jovnne Knox I tried it, but no luck. Could you please take a look at my project (1 post above yours) and try it out?
anon-4
April 26, 2018, 12:07am
14
@Jovnne Knox and @Bevtwiz Cvmpxell Samanthapudi any luck trying out my project?
anon-4
April 26, 2018, 8:26pm
15
Hi @Emewson Pvwkew
PFA of formComponent.js . Just replace this file with your.
Thanks
anon-4
April 26, 2018, 8:45pm
16
Hi @Bevtwiz Cvmpxell Samanthapudi ,
Thanks a lot. It works!