It looks like you're new here. If you want to get involved, click one of these buttons!
I linked a joSelect control to a record like this: new joSelect(languages, set.link("language"));
This works, except when set.language is initially zero.
I think the problem is in joControl.setValueSource:
setValueSource: function(source) {
this.valueSource = source;
source.changeEvent.subscribe(this.setValue, this);
this.setValue(source.getData() || null);
If source.getData returns zero, it is replaced with null.
I replaced this:
this.setValue(source.getData() || null);
with this:
var data = source.getData();
if (!data && data != 0) data = null;
this.setValue(data);
which does the same, except if getData returns zero. But I suspect this is not the best solution.
Question: how does joDataSource.getData return "invalid result"? Presumably, it shouldn't just replace any falsy value with null, as some valid values are falsy (0, false, etc).
Cheers, Stewart
Yes, this is tricky. My temporary solution is to convert your value into a string when you save and load from your joRecord code. Not pretty, but should move your forward while I look into a solution that doesn't break anything else.
Put a patch in GitHub to fix this. Would appreciate it if you pulled jo.js down from GitHub source and gave it a try without using the string hack I just mentioned. I've tested in several cases, seems to work without breaking things.