Inspect bootstrapcomponents-tabpanel

Forum to discuss the new web client version of Servoy.

Inspect bootstrapcomponents-tabpanel

Postby rieder » Wed Jan 19, 2022 11:08 am

Dear Servoy developer

I try to write code to get all subforms of an NG form. The form contains a bootstrapcomponents-tabpanel with three tabs.
How can I get the tabs of that JSWebComponent?

Thanks for any help!
Regards
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby paronne » Wed Jan 19, 2022 12:39 pm

Hi,

for the bootstrapcomponent Tabpanel you can access the tabs via the elements.tabpanel.tabs Array.
You can try this code snippet:

Code: Select all
for (var i = 0; i < elements.tabpanel.tabs.length; i++) {
   var tab = elements.tabpanel.getTabAt(i + 1);
   application.output(tab.containedForm);
}


Regards,
Paolo
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby rieder » Wed Jan 19, 2022 4:48 pm

Thank you for the answer.

I only have a form name and would like to detect tabpanels and there tabs and the forms within the tabs. My code looks like:

Code: Select all
var jsForm = solutionModel.getForm(formName);
var components = jsForm.getComponents();
for (var i in components) {
   /** @type {JSComponent} */
   var c = components[i];
   if (c['typeName'] && c['typeName'] == 'bootstrapcomponents-tabpanel') {
      // c is a tab panel. How do I get the tabs???
   }
}


Any idea is appreciated a lot. Thank you.
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby paronne » Wed Jan 19, 2022 5:40 pm

Hi,

so you mean to read the tabs using solutionModel ?

In Web Components properties can be read via solution model using the getJSONProperty(propertyName).
e.g.

Code: Select all
c.getJSONProperty("tabs")


You may need to get all elements as WebComponent rather than Components:

Code: Select all
var components = jsForm.getWebComponents();
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby rieder » Wed Jan 19, 2022 7:07 pm

Dear Paolo

Oh, wow, it works!
I was sure I did try this before.
Thanks a lot.

Best regards
Birgit
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby rieder » Fri Jan 21, 2022 6:04 pm

Dear Paolo

Now I found the reason, why it did not work before: I tried to implement code to get subforms for a list of forms. But running the same code from Smart Client returns null for the tabs. Only from within a Client with application type NG, the tabs can be retrieved.

Is this expected behaviour? Not sure...

Thanks again and regards
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby paronne » Mon Jan 24, 2022 10:37 am

Hi,

In Smart Client you can make use of the legacy TabPanel component ( your previous code would work then ).
The bootstrapcomponent-tabpanel is a WebComponent esclusive to NG; it would neither render in Smart Client.
They are in fact different components; therefore yes is expected behavior.

Regards,
Paolo
paronne
 
Posts: 202
Joined: Fri Nov 02, 2012 3:21 pm

Re: Inspect bootstrapcomponents-tabpanel

Postby rieder » Tue Jan 25, 2022 9:55 am

Hi Paolo

We currently deploy SC and NG clients for a customer. NG is new, though, until this application type runs stable, fallback is SC.

Now we have code, which will be executed in SC and NG. This code should find subforms for a selected menu (to find attributes and store access rights for the subforms). The result should be same, independent of the application type the code is executed in. For this, we iterate over all SC and NG forms, which are displayed for the selected menu. This is why we try to find subforms for an NG formname in SC. I hope, this is an understandable explanation?

Thank you for the responses and regards
Birgit Rieder
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
rieder
 
Posts: 177
Joined: Thu Jan 26, 2012 5:18 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 7 guests

cron