GithubHelp home page GithubHelp logo

Comments (4)

newyankeecodeshop avatar newyankeecodeshop commented on June 25, 2024

I've been thinking more about this, and I think that you're right that we can make everything "valueAsId" to make the programming model simpler. So the "value" prop would take one or more IDs, and the "onChange" would return one or more IDs. My only addition to this is to have "onChange" also return the valueAsObject in a second argument. So that one could have:

onChange: function (value, valueObject) {
    var newRecord = _.clone(this.state.record);
    newRecord['fooID'] = value;
    newRecord['fooName'] = valueObject.name;
    this.setState({ record: newRecord });
}

I like using a second argument for the "valueAsObject" because then people who just want to stick with IDs can totally ignore it.
What do you think?

from wingspan-forms.

dustingetz avatar dustingetz commented on June 25, 2024

Your proposal would lower the implementation complexity of valueAsObject and I think it's a good idea. The open question is if valueAsObject ought to be permitted at all as it limits how far you can abstract.

from wingspan-forms.

newyankeecodeshop avatar newyankeecodeshop commented on June 25, 2024

At this point, I'd say to not permit "valueAsObject" at all. The client (or even AutoControl) can dereference object values pretty easily. My thought was to make AutoControl do this, so records that use object-style properties would be able to continue to work unchanged. AutoControl already knows what the "valueField" and "displayField" is for a combo...

from wingspan-forms.

dustingetz avatar dustingetz commented on June 25, 2024

I agree with you and think permitting only valueAsId would result in simpler application code. Just note that "dereferencing an object value" in the most general way possible probably requires ajax, which can lead to a very request heavy app, which is why no consensus on this issue was reached. Though I would expect a lot of the requests can be mitigated through browser cache and hand optimization in hot spots. I also expect that this is a pretty involved refactor (for the TMF).

from wingspan-forms.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.