how can two separate webcomponents communicate ?

Forum to discuss the new web client version of Servoy.

how can two separate webcomponents communicate ?

Postby ashutoslenka426 » Fri Jun 23, 2017 3:05 pm

Hi All ,

I have two separate webcomponent - one is button and another is context menu . My objective is to show the context menu on the click of the button . But what it is happening is , the context menu is showing throughout the screen on the right click . Please find the code below :

Context Menu Js :
Code: Select all
$scope.api.show = function(Id , contextMenuVisible) {
          
          $scope.Id = Id;
          $scope.contextMenuVisible = contextMenuVisible;
         
          $scope.contextMenuOptions = {
              
               dataSource: contextMenuItems,
                 width: 200,
                 position: {
                    at: 'bottom left'
                },
                target: "#" + Id,
                showEvent: "",
                 bindingOptions: {
                     visible: $scope.contextMenuVisible
                 },
               onItemClick: function(e){
                  if (!e.itemData.items) {
                       DevExpress.ui.notify("The \"" + e.itemData.text + "\" item was clicked", "success", 1500);
                       $scope.handlers.onActionMethodID(e.itemData.text);
                    }
                }   
                        
            }   
         
          
      }


Please find the servoy code on the on action of the button :

Code: Select all
elements.Context_Menu_1.show(elements.Button_1.getMarkupId() , true);


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

Re: how can two separate webcomponents communicate ?

Postby rvanderburg » Fri Jun 23, 2017 3:33 pm

You must do this through the server. Using properties, methods or events. You should never make webcomponents talk to each other clientside.
rvanderburg
Site Admin
 
Posts: 78
Joined: Wed May 04, 2011 10:28 am

Re: how can two separate webcomponents communicate ?

Postby ashutoslenka426 » Mon Jun 26, 2017 7:32 am

Hi ,

Please provide some suggestions . Please share how can I can achieve this.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: how can two separate webcomponents communicate ?

Postby ashutoslenka426 » Mon Jun 26, 2017 12:45 pm

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

Re: how can two separate webcomponents communicate ?

Postby ashutoslenka426 » Wed Jun 28, 2017 10:16 am

Thanks solved using binding options.
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 9 guests