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
0
votes
1 answer

Canjs: trigger a route event for the current page

I have a can.Control that looks like this: can.Control({ "route": function(){ ... }, "a.test click": function(){ can.route.attr({ page: "home", type: "test" }); } }); "route" callback…
0
votes
1 answer

CanJS and Mustache

I'm having problem using mustache in my application. I've stolen 'can.....mustache' and I've a Model object with this structure: // widgets Models.LayoutWidget = can.Model({ findAll: 'GET /pages/{id}/layouts/widgets' }, {}); Then with a…
th3n3rd
  • 375
  • 1
  • 3
  • 20
0
votes
1 answer

CanJS url changed back to #! when can.route.ready(true) executed

Code is here: http://jsfiddle.net/cTpPx/, but view the live example here http://fiddle.jshell.net/cTpPx/show/, because I want you to observe the url changes. Please disable Chrome cache when visit this page (Tick the relevant box in the built in…
user469652
  • 48,855
  • 59
  • 128
  • 165
0
votes
1 answer

Set up a global listener/controller for events triggered on document with CanJS

Probably not the common use case, but I have several custom events being fired on document, and the application listens for them. Example: http://jsbin.com/uradod/3/edit How can I convert this to be CanJS controller? I was of something similar to…
Sherzod
  • 5,041
  • 10
  • 47
  • 66
0
votes
2 answers

CanJS storing a todo to a file

I am writing a SPA using CanJS which has a list and user can add the list. I want to store the newly added item permanently by writing it to a file. Can some one help me? '.btn_save click': function (ele, ev) { var self = this; var…
Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22
0
votes
3 answers

JavaScript templating, why so great?

I've been looking into JavaScript templating libraries like dust.js and other more extensive libraries like canJS Where I work we do nearly 99% of any application / site on the client side. Currently I just build strings of html, inject into the…
Fergal
  • 2,484
  • 2
  • 36
  • 48
0
votes
2 answers

Get Object from observable attr

I need some observable for my JSON. Data looks like this: { "event": [{ "id": 1, "name": "First", "param": { "a": 1, "b": [1, 2, 3] } }, { "id": 2, "name": "Second", "param": { "a": 1, "b":…
Vladislav
  • 371
  • 4
  • 12
0
votes
1 answer

Canjs model returns undefined after resolved

I cannot find a way to retrieve data from the server and convert them to model instance. I folloed the instructions here but it's still doesn't work. Here is my setup: url for the service: services/foo/barOne. The response is :…
Geekingfrog
  • 191
  • 1
  • 8
0
votes
1 answer

Dynamic properties for CanJS model?

I would like to add dynamic properties in my model that is not in the REST service results. These dynamic properties would shorten names, format dates, etc. For example, my CanJS model like this: var MyModel = can.Model({ findAll: 'GET…
Basem
  • 594
  • 1
  • 9
  • 25
0
votes
2 answers

creating a cookie in CANJS

I am creating a application using CANJS. To display the user Information basing on the cookie I am not not knowing how to create and delete a cookie using CANJS. can some one please help me
user1299972
-1
votes
1 answer

Cannot use 'in' operator to search for '18' in canjs

I am calling ajax function for getting data from model. I am trying to load the data in template but i cannot setting the attributes in can.list. Here is my call: this.domainModel.getDomains("domains", function (response, error) { if ('domains' in…
Dipesh Raichana
  • 1,008
  • 3
  • 18
  • 36
-1
votes
1 answer

Canjs changed event

Is there a way to detect list change in canjs and make the view redraw? I am changing the list but this is not shown on screen. At the moment i have view model TodosListViewModel = can.Map.extend({ todoCreated: function(context, element) { //…
php--
  • 2,647
  • 4
  • 16
  • 18
-1
votes
1 answer

CanJS part live-bound view, part not?

I'm building a data grid with thousands of list items and no pagination. As a result, the performance with live-binding is, understandably, very poor. With ~20 list items, there is no lag whatsoever. {{#each columns}}
Steven Vachon
  • 3,814
  • 1
  • 30
  • 30
-1
votes
1 answer

Mustache: get value by key

How to use mustache for the following scenario: el.html( can.view('ideasView', {ideas: records, photos: jQuery.parseJSON(users)})); Is it possible to access photo by {{photos[id].photoUrl}}? I need to get photoUrl by ideas[i].Id when looping…
Natallia
  • 157
  • 1
  • 9
-1
votes
1 answer

Canjs findall and findone?

So right now I am accessing the data using the findAll: 'GET api.php/stores-for-you?pid=977&sid=5938&max_fav=3&max_reco=3' which is a way to access the api for my application where pid is the page id and sid is the section id. So each page has…
1 2 3
15
16