Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deeper binding question #1

Closed
aktxyz opened this issue Apr 1, 2015 · 2 comments
Closed

deeper binding question #1

aktxyz opened this issue Apr 1, 2015 · 2 comments

Comments

@aktxyz
Copy link

aktxyz commented Apr 1, 2015

First off I really like your project.

It looks like the structure of the initial state does not need to be defined up front, for example in the hobby sample, the initial state is basically an empty data object. As you type in the form fields, the structure of the data object is filled in, and you can see that in your pretty json.

  getInitialState: function() {
    return { data: {}};
  },

I tried to see how far that would go, and created a new plnkr that added 2 more inputs

        <TextBoxInput label="Street"  model={this.bindTo(this.props.personModel,"Address.Street")} />
        <TextBoxInput label="Phone"  model={this.bindTo(this.props.personModel,"Phone.Main.Number")} />

The 2 level deep object was filled in as expected, just like your existing inputs. The 3 level deep object did not fill in. This may be expected, but not sure. It would be slick if that worked as well.

edit ...
Adding the plnkr url for the updated sample

http://plnkr.co/edit/802962ElwKUd8tPFYan2?p=preview

@rsamec
Copy link
Owner

rsamec commented Apr 3, 2015

Yes, you are right. This is not expected for the 3 level deep object. I will have a look at this issue at the weekend.

You can use workaround below - to define empty object up front.

getInitialState: function() {
    return { data: {Person:{Phone:{}}}};
  },

@rsamec
Copy link
Owner

rsamec commented Apr 7, 2015

Fixed in react-binding@0.6.0.

@rsamec rsamec closed this as completed Apr 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants