Ace Code Editor / on load

edited November 2013 in Newbie Questions
I am trying to load ace code editor in enyo. I can get the js function that loads the editor to work no problem if I place it in a button onclick. However if I try and place the js function in a event such as create it gives me an error that it cant find the div. Im guessing its because the event is being fired before the dom has finished writing.

Anyone know how to get an event to fire when Enyo is done loading everything?

Current function im using.
	create: function(){
		this.inherited(arguments);
		var editor = ace.edit("editor");
		editor.setTheme("ace/theme/monokai");
}

Comments

  • A control isn't rendered into the dom when create() is called, but only later when rendered() is called. You need to hook the ACE code then, I think,
  • Thanks iv been searching for an event that gets called after dom load.. I did try adding the rendered: function() to my app however it broke the rendering lol.. Is there any methods i need to call or pass to the function so it doesnt break the normal rendering?
  • edited November 2013
    Actually I did find what I need to add but it doesnt seem the rendered method is what im looking for. I tried
    rendered:function(){
            this.inherited(arguments);
            alert("a");	
        },	
    
    And I never get the alert.. Is there any method that gets called once the app is entirly finished loading?? I did try adding an event onload in the html @ the body element and I was able to call a method but I dont know how to get the instance of the enyo to call methods in it. got any ideas? I know there has to be a elegant way of doing this?
  • rendered won't be called on the enyo.Application object, but should be called on its view. You can also use an observer to watch the application's viewReady property and react to that changing. Providing a "viewReadyChanged" method is enough to do that.
  • render() is a method of enyo.Application, so it MIGHT work to do:
    render: function() {
        this.inherited(arguments);
        // do stuff
    }
    In the Application object. I believe it just calls render() on its view. As usual, there are a bunch of different ways to do things. Have fun!
Sign In or Register to comment.