Quantcast
Channel: JavaScriptMVC Forum
Browsing all 3491 articles
Browse latest View live

Re : When using a Component, when do I choose between the init method of the...

I dont know if component has init method!! But what I know events means can.Control it's init like can.Control.init, there's another event which is inserted where we can do initialization on the custom...

View Article


Re : When using a Component, when do I choose between the init method of the...

scope has init method, it is called prior rendering and inserting the element.events has 'inserted' event (method), that is called when element was inserted into DOM.So if you need initial...

View Article


Re : Trouble trying to create a CanJS small widget

You're right.  I think if you have a list, you should not return Deferreds or promises.  Just return a can.Model.List and push the entries into it when the findAll resolves.  Here's an example; note...

View Article

Re : Trouble trying to create a CanJS small widget

Thanks for the solution :D About an hour or so ago, I managed to find the solution on my own, which is quite similar to yours (below is the fully working widget with some pretty nifty validation on top...

View Article

Re : When using a Component, when do I choose between the init method of the...

Well, component has an init method, because I am using it right now. Didn't know scope had one as well. As for the event object, what's the difference between init and inserted, then?

View Article


Re : When using a Component, when do I choose between the init method of the...

inserted gets called when the element is inserted into the document.

View Article

CanJS and Ruby On Rails

I'm trying to use CanJS with Rails. I'm having issues with the files loading before the DOM has loaded. I've been looking at this example, which I've based my code from: canjs-mailclient-appPlease...

View Article

Re : When using a Component, when do I choose between the init method of the...

I think I get it now.In a normal CanJS Control, Init would be the place to insert the html from can.view, therefore, in the Init method from an Event object inside of a Component, the html is not...

View Article


Re : CanJS and Ruby On Rails

SMT['...'] is a gem I've used that compiles the mustache files into Javascript - smt_railsI've tried loading the templates in the page (show.html.haml) but the same thing happens i.e. the...

View Article


Re : CanJS and Ruby On Rails

So it seems that can.Component needs to have the template loaded prior to the declaration, make sense when doing `template: can.view('t-toolbar')`. I haven't come across this issue before because we...

View Article

Re : CanJS and Ruby On Rails

Maybe someone else can chime in here and tell us how do you declare a can.Component with a template that is not available yet, so the template will be only loaded when using the component.

View Article

Re : CanJS and Ruby On Rails

Im not a Ruby developer but It seems it's a server error, if just the template was not found  you have 404 error but here is 500 error, so maybe checking how SMT works and if is working fine with...

View Article

Re : CanJS and Ruby On Rails

If I move all the javascript at the bottom of the page the same problem happens as the control needs to run first as the 'app-template' contains the <toolbar> element and the component can't find...

View Article


Re : CanJS and Ruby On Rails

I found another example by Curtis Cummings where he creates an instance of his Controls, just like how my Control is created and calling it within the $.ready. I've tried this by converting my...

View Article

Re : CanJS and Ruby On Rails

This might be loading order problem sebasporto made research about this and he found modulejs that he has already suggested in his article, without component you lose custom element and the flexibility...

View Article


Re : CanJS and Ruby On Rails

I tried using modulejs but its still going to toolbar.js.coffee before discussions_app.js.coffee so it won't work as the html element still hasn't been printed to the DOM.This is what I've...

View Article

Re : CanJS and Ruby On Rails

Try to remve the curly braces in the toolbar component template: can.view('toolbar-template', {}) will be template: can.view('toolbar-template').update:Make require on both AppControl and toolbar...

View Article


Image may be NSFW.
Clik here to view.

Re : CanJS and Ruby On Rails

Removing the curly braces did the job........ I'm now getting the toolbar in the html.Sorry but I don't understand your update. Can you try again?

View Article

Re : CanJS and Ruby On Rails

Great, in the update, your Control depend on Component which is not the case so you can put :console.log('hello 1'); modulejs.require('canjs/apps/discussions/discussions_app');...

View Article

Image may be NSFW.
Clik here to view.

Re : CanJS and Ruby On Rails

Great, thanks guys!Cherif, I changed the modulejs to what you said in your update and it still works Just for the record.....I tried it again without modulejs and it didn't work....I also tried the SMT...

View Article
Browsing all 3491 articles
Browse latest View live