Giter VIP home page Giter VIP logo

Comments (9)

djhi avatar djhi commented on May 1, 2024 2

You can wrap multiple children inside a single DependentInput. I'm trying to figure out why the defaultValue is not working

from aor-dependent-input.

pimschaaf avatar pimschaaf commented on May 1, 2024

I found that setting the default value on the dependent input instead and setting the source, will correctly set these props and propagate them to the nested input. E.g.:

<DependentInput source="appointmentTimeslot" dependsOn="planned" defaultValue={1}>
    <ReferenceInput source="appointmentTimeslot" reference="timeslots" allowEmpty={true} >
        <SelectInput optionText="name" optionValue="id" />
    </ReferenceInput>
</DependentInput>

from aor-dependent-input.

anuragagarwal561994 avatar anuragagarwal561994 commented on May 1, 2024

@pimschaaf Yes I checked and your solution is working but it is still a bug as it is a hack which will solve the problem when we have one field. In case of multiple fields we can not specify multiple sources or default values in dependent input.

from aor-dependent-input.

pimschaaf avatar pimschaaf commented on May 1, 2024

@anuragagarwal561994 I don't think <DependentInput> is meant to be wrapped around multiple inputs. @djhi can you confirm?

Using multiple dependent inputs, each wrapped around only one input, should work in your case.

from aor-dependent-input.

anuragagarwal561994 avatar anuragagarwal561994 commented on May 1, 2024

@pimschaaf I agree that from the examples it is not clear for dependent inputs to be used for multiple input elements. But won't it make sense, because I usually have more than 1 field, so instead of writing separate dependent inputs for them it is much clearer for me to write a single dependent input wrapper and place multiple components.

But I surely agree that it can be another way of seeing DependentInput, may be I got confused. At present, multiple input thing works inside DependentInput component but default works in your way but for a single component.

from aor-dependent-input.

datafibers avatar datafibers commented on May 1, 2024

wish this got resolved soon

from aor-dependent-input.

djhi avatar djhi commented on May 1, 2024

We're looking for a solution for this. Stay tuned :)

from aor-dependent-input.

djhi avatar djhi commented on May 1, 2024

Should be resolved once https://github.com/marmelab/admin-on-rest/pull/913 is finished

from aor-dependent-input.

djhi avatar djhi commented on May 1, 2024

This is resolved in the next branch of admin-on-rest which will be released as 1.3.0

from aor-dependent-input.

Related Issues (13)

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.