xmartlabs / Eureka

Elegant iOS form builder in Swift
https://eurekacommunity.github.io
MIT License
11.78k stars 1.33k forks source link

Dependant rows are not hidden if the row they depends are hidden #2171

Open rohita-personatech opened 3 years ago

rohita-personatech commented 3 years ago

I have a use case where lets say there are 3 rows, A, B and C

  1. Row A is (String)
  2. Row B (Bool) depends on A
  3. Row C depends on B

When i changed the value in row A which then hides the row B, but as Row C depends on B it should also hide. As Row B is not visible.

Please help me to fix this.

mats-claassen commented 3 years ago

One option would be to declare Row C dependent on Row A and in the condition (if you use a function condition) check whether Row B is hidden. Or just replicate the logic to make row C also depend on row A which is not so elegant but will be consistent.

rohita-personatech commented 3 years ago

One option would be to declare Row C dependent on Row A and in the condition (if you use a function condition) check whether Row B is hidden. Or just replicate the logic to make row C also depend on row A which is not so elegant but will be consistent.

@mats-claassen Thanks for the reply. As i wanted to implement the dynamic forms C is not aware about the dependancy with A. Is there any way I can achieve this without adding dependancy on A?

mats-claassen commented 3 years ago

I understand. So Eureka currently does not support transitive dependencies and it also only supports "observing" the value of another row. Having said that, if you use the Condition.function type to calculate whether a row should be hidden or not, you can check whether the other row is hidden or disabled, etc.

So when Row A's value changes, evaluateHidden gets called only for rows directly dependent on it. I see 2 ways forward for you in this case:

rohita-personatech commented 3 years ago

thnaks, will try to implement this.