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

using fixtures in a different way?

Good morning! due ti the fact, that I get my models by jsonRPC via a php server, my model-functions are overridden: return can.Model.extend(     /* @static */     {                 sequence : 100,...

View Article


Re : What is the best way to reorderng items in DOM?

Ugly "solution"))) http://jsfiddle.net/GE3yf/31/ and another less ugly but still crappy. http://jsfiddle.net/GE3yf/32/ I wonder if canjs guys could come with a good one.

View Article


Re : Catching can.view load errors

This is a drawback to how jQuery implements deferreds (I'm assuming you're using jQuery here -- please correct me if otherwise).  Callbacks do not cause the deferred chain to fail on a thrown...

View Article

How to call view helper after can.Model.List data inserted to DOM

I create a fiddle http://jsfiddle.net/GE3yf/34/ But in helper callback length of '.name' is 0.

View Article

Re : How to call view helper after can.Model.List data inserted to DOM

Depends on what you are trying to achieve, but if you just want to manipulate the element {{test type}} is on, use the `el` reference instead of searching whole document with `$('.name')`. Example: add...

View Article


Re : What is the best way to reorderng items in DOM?

http://jsfiddle.net/GE3yf/35/   This is the approach I've taken, and extended to solve similar "listing" problems (user-selectable sort, reverse sorting, pagination, deferred state changes). Another...

View Article

Re : What is the best way to reorderng items in DOM?

I believe such thing as list sorting (and template updating) should be out of the box.

View Article

Re : Catching can.view load errors

Thanks for the confirmation @air_hadoken, and yes I am using jQuery Deferred's.  This also appears to be the behaviour when stealing a resource and there is an error. In the steal case it can be...

View Article


Is this a safe strategy for translating can.Map/can.Model attribute names...

I have an unfortunate scenario where I must translate attribute names (coming from a server response) prior to initialization on a Map or Model instance. I settled on this solution below. It works as...

View Article


ejs in ejs?

Hi, how do I invoke an .ejs-file from another one? Formerly I did this: <%== $.View('//myapp/viewtemplates/myremplate')%> which should be <%== can.view('//myapp/viewtemplates/myremplate')%>...

View Article

Re : ejs in ejs?

`can.view(path)` returns a render function. I think it depends on the exact CanJS version but you either want: <%== can.view('//myapp/viewtemplates/myremplate')(this) %> or <%==...

View Article

Re : Is this a safe strategy for translating can.Map/can.Model attribute...

Use can.Model (extends can.Map to support a backend API) and then put your translate logic in can.Model.parseModel .

View Article

Re : ejs in ejs?

Use can.view.render Sent from my iPhone On Jul 30, 2014, at 8:22 AM, JavaScriptMVC Forum <noreply@zohodiscussions.com> wrote:

View Article


Re : Is this a safe strategy for translating can.Map/can.Model attribute...

I already tried this suggestion and had a number of issues with parseModel. The biggest being that it seems to only apply to the CRUD methods of a model, and not when you instantiate one directly with...

View Article

Re : Is this a safe strategy for translating can.Map/can.Model attribute...

Why would you instantiate directly with the incorrect attributes?

View Article


Re : ejs in ejs?

thanks, can.view.render() works. While I am restructuring my app, it would be an idea, to switch to mustache / stache. (btw. which one? I did read, that mustache is deprecated as well?) I there a...

View Article

Re : Is this a safe strategy for translating can.Map/can.Model attribute...

I wouldn't instantiate directly (my tests case was simply to show why parseModel didn't work).  I would likely be instantiating via can.List.Map or can.Map.prototype.define instead. Let me paint a...

View Article


Re : Is this a safe strategy for translating can.Map/can.Model attribute...

Haven't tried this but I think you should be able to do this: define: {     products: {       type: Product.parseModels     } } It should cast to Product.List and use your translate logic in parseModel...

View Article

Re : Is this a safe strategy for translating can.Map/can.Model attribute...

Doesn't seem to work, unless you need to define parseModels explicitly (I was under the impression that it used parseModel for each item by default). http://jsbin.com/yosijare/1/edit?js,console,output

View Article

Re : binding problem data-picker / mustache / can-value

Thanks Cherif, for your reply. In the meantime we have solved the problem by using a view helper. We put the follwing lines into it: can.$(el).datepicker({ dateFormat: format, onSelect: function (date)...

View Article
Browsing all 3491 articles
Browse latest View live