Search code examples
swifteureka-forms

Eureka: How to change the row hidden or not by onchange function


I have a pushrow here

<<< PushRow<String>(kA) {
                $0.title = "123"
                $0.options = ["1","2","3"]
                $0.value = self.a
                }.onChange { row in
                    print(row.value!)
                    if (row.value! == "tcp") {
                        print(1)
                        self.showbc()
                    }
            }

It call an function

   func showbc() {
        let FormB = self.form.rowBy(tag: kB) as? TextRow
        let FormC = self.form.rowBy(tag: kC) as? TextRow
        FormB?.hidden = false
        FormC?.hidden = false
    }

And it have another two forms

<<< TextRow(kB) {
                $0.title = "123"
                $0.value = self.B
                $0.hidden = true
            }
<<< TextRow(kC) {
                $0.title = "456"
                $0.value = self.C
                $0.hidden = true
            }

When I change the push row value,It did print 1,but the row is still hidden. What should I do get the it correct?


Solution

  • In your showbc() function, after setting the two .hidden to false, you must call:

    FormB?.evaluateHidden()
    FormC?.evaluateHidden()