-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Question] - Dynamic Ops #422
Comments
I haven't implemented something like that yet. I played it bit right now, and I came this far: <Flop.Phoenix.filter_fields :let={i} form={@form} fields={@fields} dynamic={true}>
<.input
label={i.label}
type={i.type}
field={i.field}
{i.rest}
/>
<.input
label="Operator"
type="select"
field={Map.update!(i.field.form[:op], :id, &"#{&1}_override")}
options={[{"equals", :==}, {"less than", :<}, {"greater than", :>}]}
/>
</Flop.Phoenix.filter_fields>
This works until you type something in the text input. For some reason, the operator select resets in that case, although the parameters and the meta struct look fine. I didn't have to implement a dynamic filter form yet, and I don't know what's going wrong here yet. I was planning to implement a demo application at some point, which would also include dynamic operators in filter forms, and completely dynamic forms. But I don't know when I'll get to that. |
Thanks @woylie for the example & insight. I'll have a play with the everything see if I can come up with anything that works, work arounds or solutions :) |
Great news @woylie I got it to work with what doesn't seem to much of a hack. With my components and such the code is below - you fire a handle event in the form of all the events that the form fires off. All you need to do is take the field name which looks something like everything updates on page, nothing is disappearing for me. No need to muck around with assigns, or firing events to other components etc. Seems like a very simple nice solution - at the moment. Thanks for taking the time to point me in the right direction. Also I could leave dynamic={true} out of the equation.
Cheers! |
Actually turns out there are some more issues with it. What I have found is that A crude but doable work around for the moment is to reach into In short -> |
That's true, that's the current implementation. I'll get to the functionality for more dynamic filter form eventually. I don't have any advice at this point, unfortunately. |
All good - appreciate all the work so far on the lib :) it's great. |
Summary
Hey Woylie,
Sorry for opening a ticket - I'm trying to create some dynamic ops & looking for advice.
I'm trying to achieve something like this
Where I have certain filters, I can further drill down.
What I have implemented works with bad / non updating elements.
I have my filter_forms
Then my liveview I've the following/combo
Any guidance would be great thanks :)
Steps to reproduce
Expected behaviour
No response
Actual behaviour
No response
Elixir/Erlang version
1.15.6
Flop and Ecto versions
locked at 3.10.2 (ecto_sql) 68c018de
locked at 0.23.0 (flop) 0521d0cb
locked at 0.22.2 (flop_phoenix) 8aa7e493
Additional context
No response
The text was updated successfully, but these errors were encountered: