Eureka icon indicating copy to clipboard operation
Eureka copied to clipboard

[Question] Is it possible to block the entire form for editing?

Open amadeu01 opened this issue 6 years ago • 4 comments

I didn't find any issue related to my question. I would like to block the form from editing, is it possible to do it? Or I have to go into every cell and "disable" any editing from them?

amadeu01 avatar May 02 '19 17:05 amadeu01

I tried

for row in form.allRows {
            row.disabled = true
        }

however it didn't work

amadeu01 avatar May 02 '19 17:05 amadeu01

@mtnbarreto do you know why

        for row in form.allRows {
            row.disabled = true
        }

        tableView.reloadData()

doing this doesn't work, however if I set the row.disabled in the initialisation block it works?

amadeu01 avatar May 03 '19 18:05 amadeu01

@mtnbarreto I made one workaround.

first, I create an hidden SwitchRow

<<< SwitchRow("enabled") {
                $0.hidden = true
        }

then, a disabling Condition.function

private let disabledFunction = Condition.function(["enabled"]) { form in
        if let row = form.rowBy(tag: "enabled") as? SwitchRow {
            return (row.value ?? false)
        }
        return false
    }

amadeu01 avatar May 06 '19 14:05 amadeu01

After re-setting disabled or hidden for a row you should call evaluateDisabled or evaluateHidden to force apply this change. That is possibly why your above code didn't work

mats-claassen avatar May 08 '19 12:05 mats-claassen