How to get html css class from a element name ??

Forum to discuss the new web client version of Servoy.

How to get html css class from a element name ??

Postby ashutoslenka426 » Wed Jun 21, 2017 9:59 am

Hi All ,

Suppose I have created a button component . Dragged onto the form . I know the elements name . How can I know the css class name or id where it is rendered ? .

I required this for other component target specification.

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

Re: How to get html css class from a element name ??

Postby patrick » Wed Jun 21, 2017 10:14 am

You want to know this in the browser or in scripting?
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to get html css class from a element name ??

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

Hi ,

Thanks for your reply . I want this either in the component js or servoy js. But how this possible ?
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to get html css class from a element name ??

Postby patrick » Wed Jun 21, 2017 12:02 pm

The model object in the client js has a svyMarkupId property which you can use to assign an ID to your component (something like < ... id="{{::model.svyMarkupId}}" ... >. That allows you to deal with an ID in your component html.

The style classes can be retrieved from the element that you receive in your controller or link function.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to get html css class from a element name ??

Postby ashutoslenka426 » Wed Jun 21, 2017 1:14 pm

Hi Patrick ,

Thanks for your reply . I got your point . But I have two components - Button and contextmenu . I want to access button Markup Id in Context Menu . When I am hardcoding it is fine . But how to access it dynamically ? . How this is possible ?

Button HTMl :

Code: Select all
<div class="bts-button" id="{{::model.svyMarkupId}}" dx-button="ButtonOptions"
svy-click='handlers.onActionMethodID($event)'
svy-dblclick='handlers.onDoubleClickMethodID($event)'
svy-rightclick='handlers.onRightClickMethodID($event)'
sablo-tabseq='model.tabSeq'
ng-if="model.visible" ng-class="model.styleClass">
</div>


Context Menu Js :

Code: Select all
$scope.api.show = function() {
          
           $scope.contextMenuOptions = {
              
               dataSource: contextMenuItems,
                 width: 200,
                 position: {
                    
                    
                 },
              
                 target:"#" + "3c30fc1c75040391183fcf65f0e058e9",
               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);
                    }
                }
                        
            }   
        }


Servoy JS :

Code: Select all
elements.Context_Menu_1.show(elements.Button_2);


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

Re: How to get html css class from a element name ??

Postby ashutoslenka426 » Thu Jun 22, 2017 6:01 am

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

Re: How to get html css class from a element name ??

Postby ashutoslenka426 » Thu Jun 22, 2017 6:55 am

Thanks Solved . I did that using api call.
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 17 guests