Linked Questions

Popular Questions

Eureka - Add "None" Row when presenting PushRow

Asked by At

PushRow in my project has disabled deselection option. Currently im trying to provide the option like adding an extra "None" Row to the presented View. How can it possible ?

private func createCustomPushRow(for field: JSON) {

    let typeId = field["field_type_id"].intValue
    let type = field["field_type"].stringValue
    var label = field["field_label"].stringValue
    let required = field["field_required"].boolValue

    var optionList: [String] = [String]()
    for customField in field["field_options"].arrayValue {
        optionList.append(customField["option_title"].stringValue)
    }

    label = required ? label + " *" : label
    form +++ Section(label)
        <<< PushRow<String>(String(typeId)) {
        $0.title = label.lowercased()
        $0.selectorTitle = "Pick " + label.lowercased()
        $0.options = optionList
        if required {
            $0.add(rule: RuleRequired())
            $0.validationOptions = .validatesOnChange
        }
        }.onPresent({ (_, to) in
            to.enableDeselection = false
        })
}

Expected output

Related Questions