Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 12 19:26
    cherifGsoul review_requested #5443
  • Dec 12 18:34
    cherifGsoul synchronize #5443
  • Dec 12 18:34

    cherifGsoul on document-inserted-removed-can6

    Update after review (compare)

  • Dec 12 17:44

    cherifGsoul on theme-3.0.0-pre.5

    (compare)

  • Dec 12 17:44

    cherifGsoul on master

    Update bit-doc-html-canjs (#544… (compare)

  • Dec 12 17:44
    cherifGsoul closed #5445
  • Dec 12 17:01
    cherifGsoul opened #5445
  • Dec 12 17:01

    cherifGsoul on theme-3.0.0-pre.5

    Update bit-doc-html-canjs Upda… (compare)

  • Dec 12 16:40

    cherifGsoul on update-api-page

    (compare)

  • Dec 12 16:39

    cherifGsoul on master

    Update API page (#5432) * Upda… (compare)

  • Dec 12 16:39
    cherifGsoul closed #5432
  • Dec 12 16:39
    cherifGsoul closed #5304
  • Dec 12 01:04
    greenkeeper[bot] commented #5392
  • Dec 12 01:04

    greenkeeper[bot] on core-js-3.5.0

    chore(package): update core-js … (compare)

  • Dec 11 18:34
    greenkeeper[bot] labeled #5444
  • Dec 11 18:34
    greenkeeper[bot] opened #5444
  • Dec 11 18:34

    greenkeeper[bot] on can-observable-mixin-1.0.7

    fix(package): update can-observ… (compare)

  • Dec 11 18:30

    cherifGsoul on update-infrastructure-page

    (compare)

  • Dec 11 18:30

    cherifGsoul on master

    Update infrastructure page with… (compare)

  • Dec 11 18:30
    cherifGsoul closed #5441
Nico R.
@nriesco
is there any simple example so I can use that as the base code for my app? I can also change the value stored to a text string instead of a boolean if that makes it easier
@bmomberger-bitovi I’ll check that, if it works then I don’t need any examples :-)
Brad Momberger
@bmomberger-bitovi
The radiochange event in CanJS is the one I was thinking of. You can use it to listen to individual properties that are bound to chacked on different radio buttons in a group: https://canjs.com/doc/can-event-dom-radiochange.html
Nico R.
@nriesco
mmm it is possible to select the value but it won’t load it when editing. Also it will set the first one as false and the second option as false...
Brad Momberger
@bmomberger-bitovi
That, I guess, is the opposite of what we were thinking of.
Nico R.
@nriesco
very weird
Brad Momberger
@bmomberger-bitovi
OK, so I think that what may be going wrong here is in your view model
I have been tooling around with a JSBin and these stache snippets. I had similar problems to yours when my myVarName property was a gettersetter and didn't update the getter correctly
Nico R.
@nriesco
my myVarName is set like this in the viewmodel: ’myVarName': 'any’,
I mean defined
const MyModel = DefineMap.extend({
  seal: false
}, {
  '_id': 'any',
  ...
  'myVarName': 'any',
  ...
});
The type is the same as yours, the radio template is exactly what you were using with checked property binding.
If there is something else going on it's probably an upper level binding. Is your component where this is happening two-way bound to a parent component's property?
Nico R.
@nriesco
is it ok to use this syntax: equal(~myVar.property, 'yes’) I saw your example and it works but mine is still not working..
Nico R.
@nriesco
@bmomberger-bitovi I found two workarounds, but I can't figure out how can-value works on canjs 3.
Brad Momberger
@bmomberger-bitovi
can-value is still technically supported but it shouldn't work any differently from value:bind
also it is fine to use equal(~myVar.property, 'yes')
Nico R.
@nriesco

Workaround #1 => stores a boolean value and uses an additional variable (just ignore it):

<input type="radio" checked:bind="myVarName" name="myVarName" />      
<input type="radio" checked:bind="myVarNameDUMMY" name="myVarName" />

Workaround #2 => can store any value, limited to strings only:

<input type="radio" can-value="myVarName" value="first" />
<input type="radio" can-value="myVarName" value="second" />
Brad Momberger
@bmomberger-bitovi
Nico R.
@nriesco
those two worked perfectly fine, loading the already contained value, changing ok and setting the new value
any attempts on using equal or not caused trouble
Brad Momberger
@bmomberger-bitovi
They may not be compatible with named groups.
Using the name property could still be causing issues.
Nico R.
@nriesco
let me check
no it didn’t work. The first workaround is not the most elegant, but it does work with little effort, at least for two option radios
as you said it looks like somehow on the upper levels something is causing this
but still it looks suspicious
if I find any other evidence I’ll try to replicate it and eventually create an issue :-)
Brad Momberger
@bmomberger-bitovi
Did you ever say whether the keys in questions were bound to parent component values?
Nico R.
@nriesco
I didn’t mention it but yes there is some binding to parent components.
Brad Momberger
@bmomberger-bitovi
OK. One thing I know has been a problem in the past is multiple two-way bindings.
So if I have a parent component A and child components B and C, binding A.foo two way with B.foo and also with C.foo can have unexpected results.
Nico R.
@nriesco
that is definitely my case
Brad Momberger
@bmomberger-bitovi
OK. So you definitely did the right thing with setting the type to "any" in this child component (in my own experience, the worst thing is dealing with multiple type conversions)
But I think you might have better luck with putting your shared properties like that in an observable state object that gets passed parent-to-child in all cases.
So in the A B and C example above, I want to share foo with two-way into B and C from A, but instead I package up foo into bar which is observable, and then push bar into B and C using one-way binding to-child.
so if B flips the value of bar.foo, C will also see it because it's observing the same object.
Nico R.
@nriesco
the thing is that I don’t have many problems because the binding is mostly to set query conditions to sub elements.. I build a form from several tables each represented by a component, so you can have as many components as you want press save and all gets updated
the value I’m trying to set with the radio button is only important within its model
and is a very weird name: sellsAllCatalogListings so chances are tha I’m not using the same one on another level and that causes trouble
Brad Momberger
@bmomberger-bitovi
Having something with the same name in a parent component shouldn't be an issue. We don't let components leak scope by default
Nico R.
@nriesco
thats good to know
one thing I noticed today though is a lot of warning because of the old style bindings and an incorrect use of the type in my variables, could a warning be related to this issue?
warning 1: WARN: can-define: the definition for ok on DefineMap uses a constructor for "type". Did you mean "Type”?
warning2: WARN: can-stache-bindings: the data binding format {($value)} is deprecated. Use value:bind instead
Brad Momberger
@bmomberger-bitovi
I worked on both of those warning messages, and it's unlikely that the second one is causing a problem.
You should fix that first one, though.
And also give your DefineMap subclasses names. :)
Nico R.
@nriesco
what do you mean?