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

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

You want to know this in the browser or in scripting?

Hi ,

Thanks for your reply . I want this either in the component js or servoy js. But how this possible ?

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.

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 :

<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 :

$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 :

elements.Context_Menu_1.show(elements.Button_2);

Please provide your suggestion

Please provide some suggestions .

Thanks Solved . I did that using api call.