Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 23 19:03
    cherifGsoul synchronize #5509
  • Oct 23 19:03

    cherifGsoul on upgrade-can-ajax

    Move can-ajax tests to dev only (compare)

  • Oct 23 16:37
    cherifGsoul commented #5510
  • Oct 22 16:04
    yayan19 starred canjs/canjs
  • Oct 20 02:45
    AkiaCode starred canjs/canjs
  • Oct 19 14:39
    hkutcher opened #5510
  • Oct 19 14:38
  • Oct 17 10:58
    Fatima-Usf starred canjs/canjs
  • Oct 15 21:18
    naskio starred canjs/canjs
  • Oct 12 22:08
    cherifGsoul synchronize #5509
  • Oct 12 22:08

    cherifGsoul on upgrade-can-ajax

    xvfb services (compare)

  • Oct 12 22:07
    cherifGsoul edited #5509
  • Oct 12 22:06
    cherifGsoul opened #5509
  • Oct 12 22:01

    cherifGsoul on upgrade-can-ajax

    Update can-ajax version (compare)

  • Sep 29 13:17
    ko25july starred canjs/canjs
  • Sep 21 17:41
    cherifGsoul assigned #5508
  • Sep 21 17:39
    cherifGsoul opened #5508
  • Sep 18 19:32
  • Sep 11 02:59
    torongu starred canjs/canjs
  • Sep 09 06:57
    tbreuss starred canjs/canjs
lmagarian
@lmagarian
what's the right way to do this?
Kevin Phillips
@phillipskevin
{(list)}=“fields(parentId)”
Kevin Phillips
@phillipskevin
the way you had it should work also, except that parentId would be a compute and not the actual value
which is probably not what you want
lmagarian
@lmagarian
thanks @phillipskevin
Kevin Phillips
@phillipskevin
:thumbsup: no problem!
Viktor Busko
@Lighttree

guys, I have a component's viewModel that contains object with an array of objects. So it's like

period: {
    prop1: ...,
    prop2: ...,
    myList: [
        {},
        {},
        ...
   ]
}

Define plugin automatically converts 'period' to can.Map, 'myList' to can.List, and its items to another can.Maps.
Is there a good way to 'Define' behavior of inner maps ? (elements of 'myList').
Basically I need to do some formatting and get/set in Define might be useful.

Chasen Le Hara
@chasenlehara
Hi @Lighttree, it looks like you’re using CanJS 2, is that correct?
You can create a can.List type and then set its Map type so objects get converted into specific types: https://v2.canjs.com/docs/can.List.Map.html
That’s a little confusing so if it doesn’t make sense, you could create a JS Bin with your view model and we can provide some advice. 🙂
Here’s a JS Bin for CanJS 2: http://jsbin.com/venaje/embed?html,js,output
Viktor Busko
@Lighttree

@chasenlehara I think that you are right, and actually I tried to apply List.Map, but didn't succeed with this.

It seems that your JSbin for some another thing :)

Here is JSBin:

http://jsbin.com/pupikijaxa/1/edit?html,js,output

I'm looking for correct way to track changes of capValue in spendTimePeriodEmployeeGroups because I need to do some formatting of values + validation + do some behavior depends on values. And usually define plugin helps a lot with this.

Maybe if I can convert spendTimePeriodEmployeeGroups to can.List and elements of this list will use correct can.Map with 'Defined' behavior this will solve my issue.

deepasrikanth
@deepasrikanth
Hi I have a question about canJS Model. The model I have has an API call. I have need to make another API call to get associated objects of this model. How can I make it so that my model supports two different API calls.
Frank Lemanschik
@frank-dspeed
@deepasrikanth did you look into feathersjs
and the feathersjs canjs integration?
deepasrikanth
@deepasrikanth
have not.. will check it out.. is there any other simpler solution without another js integration?
Frank Lemanschik
@frank-dspeed
sure you can always code a function and use that
the canjs model is made for that so you simply need to code a function like a get set and then your done
simply post a jsfiddle or jsbin of your current model some one will then fast see where to do and how to do a secund call
the model in general is super model that uses http://canjs.com/doc/can-connect.html#connect_behaviors_options_
here also study maybe the chat guide for that the part about messages and usage of supermodel for that
deepasrikanth
@deepasrikanth
thanks I will check it out
Frank Lemanschik
@frank-dspeed
your welcome
Nico R.
@nriesco
is there a way to trigger an action when a user modifies an <input> element, or when you clicke somewhere else (loose focus). Something like using enter as an event.
Kevin Phillips
@phillipskevin
not sure if you’re asking something more complicated, but this is how you trigger functions from dom events: http://canjs.com/doc/can-stache-bindings.event.html
Nico R.
@nriesco
looks like onfocusout is what I was looking for.. I’ll give it a try later
thanks @phillipskevin
Chasen Le Hara
@chasenlehara
@Lighttree Yeah, I would create types for the list and the maps, then you can use define for any properties that you need on either type (like the formatted values on the individual maps).
Since you’re on CanJS 2.x, you might want to check out can-validate-legacy if you haven’t seen it already: http://canjs.com/doc/can-validate-legacy.html
Rob Lao
@viewplatgh
canlist.extend({foo:() => { this.blahblah }}) not working with typescript, this would point to module rather than the object in context. Any ideas?
Could canjs team please take care of typescript a bit
Kevin Phillips
@phillipskevin
arrow functions don’t get a new context, so it will work like that in javascript also
canlist.extend({
    foo:() => {
        // `this` is the window
    },
    bar() {
        // `this` is the List instance
    }
})
thanks! using function() {...} works
Nico R.
@nriesco
@phillipskevin I forgot to remove the first two letters (‘on’) from the event name, now I’m using ($focusout)=".save(.)” and it works :-)
Kevin Phillips
@phillipskevin
:thumbsup: great @nriesco
Nico R.
@nriesco
is it possible to do this in can 2.x? this.attr(‘myAttr’, new MyObject({a:1,b:2})
and then in the .stache file use {{#with}} and access/edit the object properties?
Nico R.
@nriesco
I couldn't make it work using donejs
Nico R.
@nriesco
any ideas?
Kevin Phillips
@phillipskevin
@nriesco can you share a JSBin?
lmagarian
@lmagarian
I have a property on a superMap that needs to load via another API. I'm trying this but know it's not right. Any tips?
"possibleEvents": {
"value": [],
"get": function () {
return Event.getList({}).then( function ( eventList ) {
return eventList;
});
}
},
Nico R.
@nriesco
@phillipskevin this would be the closest to what I’m trying to do
Chasen Le Hara
@chasenlehara
@lmagarian You could assign eventList to another property in your view model, so possibleEvents is the promise and eventList is the array.
I personally like to follow this pattern of having one property be the promise: https://github.com/donejs/bitballs/blob/master/public/components/player/list/list.js#L64-L68
Then use the promise’s value in a template, or wherever else: https://github.com/donejs/bitballs/blob/master/public/components/player/list/list.stache#L19