Questions tagged [canjs-control]

19 questions
4
votes
1 answer

CanJS - Control Communication

I am learning CanJS now , so I want to try a very basic small demo. The demo is you will have different types of mobile recharge plans which displayed on the top (Radio buttons) and by choosing each plan the corresponding price options will be…
Sabha B
  • 2,079
  • 3
  • 28
  • 40
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
vote
1 answer

How to bind an event to Can.Control to run whenever an element matching the selector is added to the control element?

I am trying to build a DateTimePicker Widget and do not want to worry about the instantiation of the widget so I have created a Can.Control which takes the html body as the element. But, now my input elements are rendered in the DOM using can.view.…
Neil DCruz
  • 195
  • 2
  • 13
1
vote
2 answers

Understanding Canjs Control sample

Am looking at the Canjs Sample for Control. TaskStriker = can.Control({ "{task} completed": function(){ this.update(); }, update: function(){ if ( this.options.task.completed ) { this.element.addClass(…
Aravind R
  • 716
  • 1
  • 10
  • 36
1
vote
2 answers

jQuery + canJS: click on nested List to many propagation

i'm using canJs 1.1.8 and jQuery. i have a nested list with some german states
1
vote
2 answers

CanJS right click event

how can I bind a right click event in CanJS? I've attempted the following, but I guess click only captures left clicks (as ev.which doesn't log 3 on right clicks). '.btn click': function (el, ev) { console.log(ev.which); switch(ev.which) { …
veksen
  • 6,863
  • 5
  • 20
  • 33
1
vote
1 answer

can.Control.defaults and options merging

Using can.js I have this control: var Test_Controller = can.Control({ defaults: { option1: 'option1', option2: 'option2', option3: { nested1: 'nested1', nested2: 'nested2', nested3:…
AndyFlan
  • 11
  • 1
  • 4
1
vote
1 answer

CanJS future element event binding

The CanJS documentation has an example like this: var Todos = can.Control.extend({ init: function( element , options ) { ... }, 'li click': function( li ) { ... }, 'li .destroy {destroyEvent}': function( el, ev ) { // previous…
Brian
  • 7,394
  • 3
  • 25
  • 46
1
vote
1 answer

CanJS table click event

I am writing an canJS application and so far successful in handling the click event for an html table. Using the following code. 'table td click':function(el,event){ console.log('clicked ',el.text()); } How to listen to only first…
Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22
1
vote
1 answer

CanJS click event implementation

I am using CanJS (a js framework) for my project, but I have a problem. I've written some code in book.js as follows: Book = can.Model({ create: 'POST site/book' },{}); Books = can.Control({ '.gotoPrevPage click' : function(){ …
0
votes
0 answers

CanJS - correct way to pass a callback from the viewmodel to the stache file

I have an old CanJS component which is renders a React component, and where now I need to pass a callback. I found a way to pass the callback but I feel it's not the best way because in some cases it seems that the viewmodel reference is not the…
Ninita
  • 1,209
  • 2
  • 19
  • 45
0
votes
0 answers

How to solve Error: is not a function (code refactoring)

How can I properly refactor this code (it works, but it needs to be placed in a separate function) When I put it in the function below, I get an error - getConcatCategories is not a function this is a code and I want invoke the function in the same…
OlehZ
  • 13
  • 1
  • 5
0
votes
1 answer

canjs :not-selector in event triggers

I've been stuck with the following situation. 1st I add click-event handler to the all elements of the page, which invokes a small popup. I'm not able to isolate the popup from this *-selector, thus it opens the popup in to popup and so on. I've…
Heikki Mustonen
  • 301
  • 3
  • 15
0
votes
1 answer

Pass data from child click to parent event callback in CanJS

In CanJS controller, I am using click event inside another click handler. How can I pass some data to parent handler from child handler someController=can.Control({ init:function(element,options){ // some code }, …
Ankur Aggarwal
  • 2,993
  • 5
  • 30
  • 56
0
votes
1 answer

Can.js - Adding a can.Compute to prototype

How might I add a can.compute to a can.Control instance prototype? I'm trying to pass it into the instance functions with extend, but all instances of the class share the same single instance of the compute. can.Control.extend('App.Window', { …
savinger
  • 6,544
  • 9
  • 40
  • 57
1
2