How to call a Servoy method from html in ngclient.

Forum to discuss the new web client version of Servoy.

How to call a Servoy method from html in ngclient.

Postby ashutoslenka426 » Thu Oct 12, 2017 3:10 pm

Hi All ,

Is Handler the only option to call a servoy method from html ? . I am doing so but with no success .

Code: Select all
var parent_template = '<div class="file-header"><a href="#"><i class="add-plus-icon" onclick=$scope.handlers.onMenuItemClicked("header" , "attachment");></i></a><span class="text">Document</span></div>';


This is not working . Why ? . Is there any other option to just call a servoy method .

Please provide suggestions.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to call a Servoy method from html in ngclient.

Postby jasantana » Thu Oct 12, 2017 9:25 pm

Is that in a web component HTML file?
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: How to call a Servoy method from html in ngclient.

Postby ashutoslenka426 » Fri Oct 13, 2017 6:32 am

No that is not in the webcomponent html file . We are giving that html as the template to the webcomponent .
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to call a Servoy method from html in ngclient.

Postby jasantana » Fri Oct 13, 2017 9:18 am

But basically that the HTML the webcomponent will use.

Try this:

Code: Select all
var onClickMethod="handlers.onMenuItemClicked('header' , 'attachment');";
var parent_template = '<div class="file-header"><a href="#"><i class="add-plus-icon" ng-click="'+onClickMethod+'"></i></a><span class="text">Document</span></div>';
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: How to call a Servoy method from html in ngclient.

Postby ashutoslenka426 » Fri Oct 13, 2017 9:49 am

Thanks Juan for your support . But this is not working . Please help me.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to call a Servoy method from html in ngclient.

Postby paronne » Fri Oct 13, 2017 10:06 am

Hi,

your approach won't easily work. You are trying to use ng method within an HTML area.
You have some complexity which won't easily allow you to achieve what you are looking for. Angular methods are bound to a specific scope, each component directive has his own scope, therefore in the case of the HTML area you are bound within the scope of the HTML component itself. And the HTML area doesn't have an handler onMenuItemClicked("header" , "attachment"), therefore your code as is simply won't work.

What exactly are you trying to achieve exactly, what are you rendering in the HTML area what is your end goal ?

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

Re: How to call a Servoy method from html in ngclient.

Postby ashutoslenka426 » Fri Oct 13, 2017 10:22 am

Hi ,

Thanks . Let me describe the entire stuff .

1.I am developing webcomponent using devexpress . This is context menu component where menu items are listed .
2.We are having a header menu item and child menu items.
3.We provide html template from servoy side to the component . So accordingly the context menu will be rendered . There is an itemTemplate event in which it is handled
4.There is an itemClick event in which we can call servoy handler method . We can pass the text of the menu item.
5.Our requirement is , we are having a small icon in the header . only on that click we have to show a servoy dialog . How to achieve this ? .

Please provide suggestion.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to call a Servoy method from html in ngclient.

Postby ashutoslenka426 » Fri Oct 13, 2017 11:48 am

Sorry . I has an easy solution . I could able to do it by passing the classname of the icon .

Thanks
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 2 guests

cron