These are chat archives for canjs/canjs

22nd
Jun 2015
Luis Merino
@Rendez
Jun 22 2015 08:26
Hi, I saw that for 2.3.0 there was a plan to improve cross-component communication, does anyone know what's the status on that. For me it's a crucial factor that's keeping me from using canjs in my current company
Chris Gomez
@akagomez
Jun 22 2015 13:17
@Rendez I think that progress has been logged here: bitovi/canjs#1700
Chris Gomez
@akagomez
Jun 22 2015 17:04
Using <can-import> for the first time. So glad to finally have a solution in place for template dependencies.
Worked like a charm.
Justin Meyer
@justinbmeyer
Jun 22 2015 18:16
@Rendez what type of cross-component communication?
Justin Meyer
@justinbmeyer
Jun 22 2015 18:22
@dylanrtt that's probably something we should fix
@akagomez maybe I didn't read the example fully
but this to me seems a problem with not keeping the value and options in sync
this might be something can.view.live needs a special case to fix
@dylanrtt can you create an issue?
someone can take a look at this
dylanrtt
@dylanrtt
Jun 22 2015 18:26
sure
Justin Meyer
@justinbmeyer
Jun 22 2015 18:27
just to make sure I see what the problem is ... basically if <option>s are added / removed from the DOM, the selected one is not currently maintained?
just saw your issue ... if you could provide a bit of text around the bug, that would be helpful
(issues that people have to "dive into" to have an idea about what's breaking are fixed a bit slower then ones where it's more immediately obvious)
thanks!
I wonder if this is a problem with normal live-binding
as much as it is w/ two way binding
Chris Gomez
@akagomez
Jun 22 2015 18:32
@justinbmeyer Yeah, I read it wrong. I think you’ve got it.
So as new <option>’s are rendered as children of a <select> element they should check their value against the can-value property of the parent <select>?
And add selected to the <option> element.
@justinbmeyer You mean if I rebuild the list of <option> tags with JS in general, will the selected option be marked selected?
Justin Meyer
@justinbmeyer
Jun 22 2015 18:36
I don't think it will
I'm not sure
but it should be
Chris Gomez
@akagomez
Jun 22 2015 18:42
@justinbmeyer Doesn’t look like it: http://jsbin.com/bazavuxiro/edit?html,js,output
Justin Meyer
@justinbmeyer
Jun 22 2015 18:43
what is that supposed to show?
oh
Chris Gomez
@akagomez
Jun 22 2015 18:44
If the list of options is rebuilt with the same values the selected element is not shown as selected.
Justin Meyer
@justinbmeyer
Jun 22 2015 18:44
it works for me
Chris Gomez
@akagomez
Jun 22 2015 18:44
Really? Browser?
Justin Meyer
@justinbmeyer
Jun 22 2015 18:45
nm
had to hit autorun
yeah
this is the problem
I suppose that live-binding should check if the parent element is a <select>
and make sure the value is maintained if possible
Chris Gomez
@akagomez
Jun 22 2015 18:50
@justinbmeyer If you detach and append the exact same <option> elements, it shows the correctly selected option item: http://jsbin.com/tupodanihu/1/edit?html,js,output
Although I’m not really surprised by that now that I think of it.
Justin Meyer
@justinbmeyer
Jun 22 2015 18:50
yeah, b/c of Selected