help with enyojs!!!

edited May 2013 in General
Hi Gents,
I've been trying to override a function of some Kinds defined but in some cases,it work in other it does not.

Does not work:
 OB.UI.ListBpsLine.prototype.create= function () {
    
    this.inherited(arguments);
    this.$.identifier.setContent(this.model.get('_identifier') + ' / ');
    this.$.address.setContent(this.model.get('locName'));
	
  };
error: Uncaugh error trying to apply... etc etc

Work:
OB.UI.BusinessPartner.prototype.renderCustomer= function (newCustomer) {
	if(newCustomer!='') {
		if(this.order.get('bp')) {
			//Search Loyalty Point
			var me = this,
	          criteria = {
	          id: this.order.get('bp').get('id')
	          };
			//*
			function errorCallback(tx, error) {
				OB.UTIL.showError("OBDAL error: " + error);
			}

			function successCallbackBPs(dataBps) {
				if (dataBps && dataBps.length > 0) {
					me.setContent(newCustomer + ' / ' + OB.I18N.getLabel('WPLP_LblLoyPoints') + ' : ' + dataBps.at(0).get('wppoint'));
				}
			}

			OB.Dal.find(OB.Model.ExtBusinessPartner, criteria, successCallbackBPs, errorCallback);
			
			
		} else {
			this.setContent(newCustomer + ' / ' + OB.I18N.getLabel('WPLP_LblLoyPoints') + ' : ');
		}
	} else {
	  this.setContent(newCustomer);
	}
  };
I thinks that is a problem with the :
    this.inherited(arguments);
Please help...

Another thing how I can overrite a properti of a kind inside some components for example:
enyo.kind({
  name: 'OB.UI.ListBps',
  classes: 'row-fluid',
  handlers: {
    onSearchAction: 'searchAction',
    onClearAction: 'clearAction'
  },
  events: {
    onChangeBusinessPartner: ''
  },
  components: [{
    classes: 'span12',
    components: [{
      style: 'border-bottom: 1px solid #cccccc;',
      classes: 'row-fluid',
      components: [{
        classes: 'span12',
        components: [{
          name: 'bpslistitemprinter',
          kind: 'OB.UI.ScrollableTable',
          scrollAreaMaxHeight: '400px',
          renderHeader: 'OB.UI.ModalBpScrollableHeader',
          renderLine: 'OB.UI.ListBpsLine',
          renderEmpty: 'OB.UI.RenderEmpty'
        }]
      }]
    }]
  }],
  clearAction: function (inSender, inEvent) {
    this.bpsList.reset();
    return true;
  },
  searchAction: function (inSender, inEvent) {
    var me = this,
        filter = inEvent.bpName;

    function errorCallback(tx, error) {
      OB.UTIL.showError("OBDAL error: " + error);
    }

    function successCallbackBPs(dataBps) {
      if (dataBps && dataBps.length > 0) {
        me.bpsList.reset(dataBps.models);
      } else {
        me.bpsList.reset();
      }
    }

    var criteria = {};
    if (filter && filter !== '') {
      criteria._filter = {
        operator: OB.Dal.CONTAINS,
        value: filter
      };
    }

    OB.Dal.find(OB.Model.BusinessPartner, criteria, successCallbackBPs, errorCallback);
    return true;
  },
  bpsList: null,
  init: function (model) {
    this.bpsList = new Backbone.Collection();
    this.$.bpslistitemprinter.setCollection(this.bpsList);
    this.bpsList.on('click', function (model) {
      this.doChangeBusinessPartner({
        businessPartner: model
      });
    }, this);
  }
});
I need to modified the property "renderLine" (with another kind), of the kind "bpslistitemprinter" that is inside of two componets. I'm trying with:
OB.UI.ListBps.prototype.kindComponents[1].components.bpslistitemprinter.renderLine='new kind';
and this do not work either.

Helpppp, thanks.

I not an expert in enyojs but I'm trying to learn it, i will appreciate your help. ;)

Thanks,
Alejandro


Comments

  • this.inherited() only works on methods that you define as part of the kind description that you pass to enyo.kind(). This is because part of what enyo.kind() does is setup properties on all the methods that link them to versions in the parent kind.

    It's generally frowned on trying to directly modify the prototype of enyo kinds... what are you trying to do here?
Sign In or Register to comment.