These are chat archives for canjs/canjs

28th
Jun 2016
qantourisc
@qantourisc
Jun 28 2016 09:12
Quick question: stache checkboxes ?
canjs/canjs#2210
"we should document that behavior for checkboxes and radiobuttons... still confusing for users" :)
Solved by reading gitter logs as mentioned in that link.
Kevin Phillips
@phillipskevin
Jun 28 2016 13:47
I usually do something like <input type="checkbox" {{#if optionsContain(.)}}checked{{/if}} ($change)="toggleOption('{{.}}')”>
qantourisc
@qantourisc
Jun 28 2016 13:48
Interesting you can use if in a tag.
Kevin Phillips
@phillipskevin
Jun 28 2016 13:50
yeah, you can
very useful for toggling properties / classNames / etc
qantourisc
@qantourisc
Jun 28 2016 13:53
How would you deal with select then ? currently using a component, wich I pass (several) option lists, so it's simple like: <comp-selecect ({value})="localmap.tohere" ({options}) ... />
Kevin Phillips
@phillipskevin
Jun 28 2016 13:54
I still use can-value for select
qantourisc
@qantourisc
Jun 28 2016 13:55
I see, I'd consider a helper, but I suspect that manipulating it that way is going to be tricky, as you will probably be doing straight dom manipulation then.
Sunil George
@georgesunil81
Jun 28 2016 16:16
A quick question hopefully, I am using the following syntax to get to an object within a define-getter on a model. It is always returning undefined. Not sure if the syntax is correct -
this.attr('professionalRoles[0].role')
The above line is supposed to fetch the value of key 'role' within the first object in an array of objects
Is there another way to fetch maybe? The above is always returning undefined. (I have checked that the object itself is good)
this.attr('professional.title) works fine.
It is just when I encounter an array of object that I am having issues!
Kevin Phillips
@phillipskevin
Jun 28 2016 16:19
you’d have to do this.attr('professionalRoles.0.role’)
Sunil George
@georgesunil81
Jun 28 2016 16:19
Oh!
Kevin Phillips
@phillipskevin
Jun 28 2016 16:19
[] syntax doesn’t work in attr
Sunil George
@georgesunil81
Jun 28 2016 16:19
Let me try that.
Kevin Phillips
@phillipskevin
Jun 28 2016 16:19
or you can do this.attr(‘professionalRoles’).attr(0).attr('role’)
Sunil George
@georgesunil81
Jun 28 2016 16:19
Yipeeee, it worked.
Thanks @phillipskevin . That was not so obvious for me.
Thanks for your help.
Kevin Phillips
@phillipskevin
Jun 28 2016 16:20
no problem
qantourisc
@qantourisc
Jun 28 2016 19:56
Weird, when you implement findAll with a function, it takes at maximum 2 arguments
I'd expect it to take 1 or any amount, not 2
ow I see, it's probably a generic function to work also for the save/edit/update/del