Can i pass params in the do Methods

Hi Team,

Can i call a method with params in it, like
this.doGoTables({id: id});

Added below the total code -
	name : 'OB.UI.Section',
	kind : 'OB.UI.ToolbarButton',
	icon : 'btn-icon',
	events : {
		onAddNewOrder : '',
		onGoTables: ''
	handlers : {
		onLeftToolbarDisabled : 'disabledButton',
		ontap: "anythingTap"
	disabledButton : function(inSender, inEvent) {
		this.isEnabled = !inEvent.status;
	initComponents : function() {
	anythingTap : function(inSender, inEvent) {
		var id =;
		this.doGoTables({id: id});

The method onGoTables() is present in its parent class -
	name : 'OB.OBPOSPointOfSale.UI.SectionBar',
	classes : 'span12',
	components : [ {
		tag : 'ul',
		classes : 'unstyled nav-pos row-fluid',
		name : 'toolbar'
	} ],
	handlers: {
		onGoTables: 'goTables',
	initComponents : function() {
		var sectionDetail = new OB.DS.Process('org.openbravo.retail.posterminal.steward.SectionDetail');
		me = this;
		function (data) {
			enyo.forEach(data.sections, function(section) {
					kind : 'OB.OBPOSPointOfSale.UI.TablesButton',
					button :  {
						kind : 'OB.UI.Section',
						content: section.sectionName,
						id: section.sectionId
			}, this);
	goTables: function(inResponse) {
		alert("in go tables");

How can i access the data in params like the ID which i set passed in the params.



  • You've got the right idea. Custom event handlers have the same method signature as built-in event handlers (there's really no difference between the two).
    function eventHander(inSender, inEvent) {}
    In your example, the object you passed to doXXX() will be the inEvent parameter in your handler:
    goTables: function(inSender, inEvent) {
    As an aside, Enyo expects that the event payload be an object so it can be decorated by the framework and other kinds in the event chain. So, if you want to pass a primitive type (integer, boolean), you must wrap it with an object (like you did above). If you want to pass an object, be aware that if you just pass your object to doXXX, the object will be modified by the framework. To avoid this, wrap that object as well like so:
    someMethod: function() {
       // this is my custom object, perhaps it represents an entity in a database
       var data = {id:123, name:"mydata"};
       // wrapping it in another object so that object is modified
       // by the event chain and not the object above
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!