Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Cannot make changes after using row.value #52

Closed
wstudios opened this issue Jun 1, 2015 · 1 comment
Closed

Cannot make changes after using row.value #52

wstudios opened this issue Jun 1, 2015 · 1 comment

Comments

@wstudios
Copy link

wstudios commented Jun 1, 2015

Hi, great plugin. I am using something similar to the category list to have multiple selections, I would like to have some or all checked since the form will be in edit mode. It works great for setting the selected but I can no longer make any changes to the field. The following is my row for my medical app. I appreciate any help.

I am using swift 1.2 with xcode 6.3.2 and targeted for ios 8 >

    row = FormRowDescriptor(tag: Static.incidents, rowType: .MultipleSelector, title: "Incidents")
    row.configuration[FormRowDescriptor.Configuration.Options] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
    row.configuration[FormRowDescriptor.Configuration.AllowsMultipleSelection] = true
    row.value = [4,8]
    row.configuration[FormRowDescriptor.Configuration.TitleFormatterClosure] = { value in
        switch( value ) {
        case 1:
            return "Meds - missed or refused to take"
        case 2:
            return "Missed meal / ate little or nothing"
        case 3:
            return "Unmanaged urinary incontinence"
        case 4:
            return "Unmanaged bowel incontinence"
        case 5:
            return "Stumble/near-fall"
        case 6:
            return "Fall"
        case 7:
            return "Alcohol/substance abuse during visit"
        case 8:
            return "Emergency room visit"
        case 9:
            return "Violent behavior, struck caregiver, pulled hair"
        case 10:
            return "Unable to rise (new event)"
        case 11:
            return "Unable to go up/down stairs (new event)"
        case 12:
            return "Notable increase in bathroom trips"
        case 13:
            return "Notable decline in ADL capacity"
        case 14:
            return "Increased confusion"
        case 15:
            return "Increased agitation or combativeness"
        case 16:
            return "Increased listlessness or depression"
        default:
            return nil
        }
        } as TitleFormatterClosure

    // row.value = [4,8] <-- Tried here too but same result....
    section2.addRow(row)
@wstudios
Copy link
Author

wstudios commented Jun 2, 2015

Figured it out after digging through the codes, you have to pass back a NSMutableArray.
var selectedArray : NSMutableArray = [4,8]
row.value = selectedArray
That would be great to add to the documentations for those searching for the fix.

@wstudios wstudios closed this as completed Jun 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant