Questions tagged [canjs]

CanJS is an MVC/MVVM library for JavaScript with modern features like live-binding and computed values.

CanJS is an open source JavaScript MVC framework for professional JavaScript developers who need advanced capabilities in an easy-to-use package.

CanJS emphasizes writing quality code that results in maintainable, fast applications. It includes templates with two-way binding, observables that connect to a RESTful JSON interface, and routing/deep linking support.

Links

Asking a question

  • Link to documentation where possible
  • Reduce the problem to the smallest working example
  • Create a JSFiddle or clone this basic one to show functional code

Answering a question

  • If documentation exists on CanJS.com, link to it
  • If documentation does not answer the question, open a new CanJS issue with the Documentation label and link to the question
  • If the question identifies a bug:

CanJS is primarily developed by Bitovi for use in real-world projects.

226 questions
2
votes
2 answers

How to add dynamically a row to a table in the ejs using jquery?

I have a table that i am rendering in the ejs template. Now in the template, i have a bootstrap nav tabs. In each tab there is a table which is being rendered in the ejs. Now there is Add button in the table head and if i click it, it will simply…
Setu Kumar Basak
  • 11,460
  • 9
  • 53
  • 85
2
votes
1 answer

Using canjs with webpack

I am trying to use canjs with webpack. I am not able to get it working. Any help is appreciated. I did the following: Approach 1: I installed canjs using npm and in my main.js require('can'); Ran the webpack command. Did not work. The code was…
Ananth
  • 110
  • 3
  • 11
2
votes
2 answers

change event on compute of a List

I have a Map like so: var AppState = can.Map.extend({ sites: null }); appstate = new AppState(); the list gets populated like this: Site.findAll({}, function(sites) { appstate.attr('sites', sites); }); which I pass to a control like this: new…
nick lang
  • 65
  • 4
2
votes
1 answer

The best way to show loader message during model.list loading

I created a simple MVC application with canjs for an users list, by using can.Model.List. Since my request could take more than 5 second, I would add in the view a little preload message/image during the loading. i.e. I would something like this…
2
votes
2 answers

Canjs - Extending can.Model with additional Methods

I'm not the first person to ask this... the answers basically say "Well you're doing REST wrong." Fair enough, but development is filled with tradeoffs and I often find myself not in a position to rewrite the API. Moving on to the problem at hand,…
savinger
  • 6,544
  • 9
  • 40
  • 57
2
votes
1 answer

Canjs – When to use which mustache tag when iterating lists?

There seems to be a few different ways to do the same thing in Can.js, which is great! But some of the ways work a little differently than others, and can affect how the DOM is rendered and updated. I'd appreciate it if someone could clear up the…
savinger
  • 6,544
  • 9
  • 40
  • 57
2
votes
1 answer

CanJS parseModels and data coercion

I think I may have an odd use case here. I've got a Code model with code, title, description attributes. Users are documenting work (healthcare), they enter the code, say 7, and 7 always means that something particular happened, say "The patient was…
savinger
  • 6,544
  • 9
  • 40
  • 57
2
votes
3 answers

How can I get the length of a deferred Model in CanJS?

I am getting a model deferred object with a structure like this: How can I find out how many objects are present inside this object (in this case, three). If I use Object.keys(myObject).length, it includes the object observer and other data also…
Ankur Aggarwal
  • 2,993
  • 5
  • 30
  • 56
2
votes
1 answer

Canjs Not Routing

so this bug is killing me as I have no clue what's going on, I updated my canjs version to the latest which is currently 2.0.4 with jquery, and the router stopped working. Is not routing anything, I try with window.location.hash and can.route.attr…
rdk1992
  • 406
  • 1
  • 5
  • 20
2
votes
1 answer

Could not get any raw data while converting using .models canjs

With the new CanJS update, my Models stopped working and I dont know why. This is what my code looks like: Module = can.Model.extend({ findAll: 'GET ' + window.rootPath+'api/module' }, {}); FormModule = can.Control.extend({},…
Glund
  • 507
  • 1
  • 5
  • 20
2
votes
1 answer

CanJS multiple page app

The tutorials and example I've seen are all single page application. Can anyone give an idea or point to a resource showing how a multiple page app can be developed with CanJS?
Steve Ng
  • 1,189
  • 1
  • 13
  • 35
2
votes
3 answers

CanJS findOne by name

I am using CanJS for a web application. I want to know how to implement search. I have implemented findAll but i want to implement findOne based on the name and not id. var Library = can.Model({ findAll: "GET /libraries", findOne: …
Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22
2
votes
1 answer

Difference between JavaScriptMVC and CanJs

Call me stupid, but I'm quite confused. Are they the same and can.js is simply its successor? They seem to share quite a lot of functionality. As JavaScriptMVC is not updated as regulary as CanJs I think about switching to the latter. Does anyone…
hugo der hungrige
  • 12,382
  • 9
  • 57
  • 84
2
votes
1 answer

CanJS models: attr function and nested data

In canJS I can set a model property with person.attr('name', 'John Doe');, but sometimes that property contains nested data, so I need to do the following: var address = person.attr('address'); // Update country address.country = 'USA';…
Tamás Pap
  • 17,777
  • 15
  • 70
  • 102
2
votes
1 answer

Finding the name of the Control attached to a element in CanJs

I am using Canjs to build my Web application . Now i have a issue while i am working on it. The controllers get changed on a Single HTML element and the controllers that got attached to that particular element does not get destroyed when the new…
user1299972
1
2
3
15 16