Closed okelepko closed 8 years ago
http://jsbin.com/pesupobona/1/edit?html,js,output <- with issue number.
Additionally if you have a field config like
return [{
key: 1,
type: 'input',
defaultValue: 'Hello!',
},
{
key: 0,
type: 'input',
}];
Both fields get updated, likewise if you change 0
to false
No key: Default values get put in the model. If no key is specified, there is nowhere to put the default value. The parseSet()
function, which takes care of setting values in the model, will bail out instantly.
I suppose this is the correct behavior, though it might make sense to add a check that warns if defaultValue is used in a field that has no key?
Numbers as keys: Looking at parseSet()
/parseGet()
, the intended behavior seems to be that numeric keys mean array indexes. However, the same check that correctly exits parseSet()
for the non-existing key, will also exit the function if a 0
key is used.
This check should probably be modified to permit 0
keys. I'll make a pull request for that...
I'm guessing this was closed by #667
Add a field without a key at index 0 Observe defaultValue is not applied to it Add a field with key 0 Observe that it is bound to model[1], not model[0]
http://jsbin.com/paboqinage/1/edit?html,js,output