1

Pretty please help. I tried to write my own class , for example:

function doGet() {
  var app = UiApp.createApplication();
  var o = new myClass.o('Name');
  var i = o.show()
  app.add(i);

  return app;
}


//Class

function o(name){

   this.app = UiApp.getActiveApplication();
   this.name = name
}

o.prototype.show = function() {   
  var app = this.app;

  var myPlace = this.createPlace();
  var myForm = this.createForm();
  var myBar = this.createBar();

  myForm.setWidget(0,0, myBar);
  myPlace.setWidget(0,0, myForm);

  return myPlace

 };

o.prototype.createPlace = function() {

  var app = this.app
  var id = this.name+'_'+'myPlace'; 

  var place = app.createGrid(1,1)
    .setId(id)
    .setStyleAttribute('margin', '0px')
    .setCellSpacing(0)
    .setCellPadding(0)
    .setBorderWidth(0);

  return place
};


o.prototype.createForm = function() {
  var app = this.app
  var id = this.name+'_'+'myForm'; 

  var form = app.createGrid(4,1)
     .setId(id)
     .setStyleAttribute('margin', '0px')
     .setCellSpacing(0)
     .setCellPadding(0)
     .setBorderWidth(0);

  return form
};


o.prototype.createBar = function() {

   var app = this.app;
   var id = this.name+'_'+'Bar'; 

   var bar = app.createGrid(1,10)
     .setId(id)
     .setStyleAttribute('margin', '0px')
     .setCellSpacing(0)
     .setCellPadding(0)
     .setBorderWidth(0);


  var button = this.createButtonRefresh()
  bar.setWidget(0,0,button)


  return bar

 };


 o.prototype.createButtonRefresh = function() {

   var app = this.app;
   var handler = app.createServerHandler('???????????');
   var myPlace = app.getElementById(this.name+'_'+'myPlace')
   handler.addCallbackElement(myPlace)


  var id = this.name+'_'+'btRefresh'; 
  var button = app.createButton('Refresh')
     .setId(id)
     .setFocus(true)
     .addClickHandler(handler);  

  return button

 };

o.prototype.navEvent = function (){
   Logger.log('Joooo')
}

All it works, only where there are ' ? ? ? ? ? ? ' I have a problem. There I need navEvent. I tried many combinations call, but still reports that it can not find a function. Of course, normal function as handler works, but I'd like a custom class method. Tell my please someone if it is possible to set a button handler method of the object 's own class. If it can, how?

I thank you in advance for your help.

Community
  • 1
  • 1

0 Answers0