Andrey M.
Andrey M.

Reputation: 3079

How to make two mutually exclusive segmented rows with Eureka

I use Eureka library and i want to make the two mutually exclusive segmented rows with this code:

        <<< SegmentedRow<String>("weight1") { row in
            row.options = ["До 3 кг", "До 5 кг"]
            row.value = "До 3 кг"
        }.onChange{ [weak self] row in
            let weight2Row: SegmentedRow<String>! = self?.form.rowByTag("weight2")
            weight2Row.value = nil
        }

        <<< SegmentedRow<String>("weight2") { row in
            row.options = ["До 16 кг", "У меня авто"]
        }.onChange{ [weak self] row in
            let weight1Row: SegmentedRow<String>! = self?.form.rowByTag("weight1")
            weight1Row.value = nil
        }

But if i click on second Segmented row the first segmented controll don't clean up the selection

enter image description here

Upvotes: 2

Views: 949

Answers (1)

Shubhank
Shubhank

Reputation: 21805

As explained in the guide - section How to set the form values using a dictionary

If the form was already displayed we have to reload the visible rows either by reloading the table view tableView.reloadData() or invoking updateCell() to each visible row.

so just call weight2Row.updateCell() to have the new values reflect.

Upvotes: 2

Related Questions