Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable state on rows not working when changed programmatically #62

Closed
Jeehut opened this issue Jul 8, 2014 · 2 comments
Closed

Disable state on rows not working when changed programmatically #62

Jeehut opened this issue Jul 8, 2014 · 2 comments

Comments

@Jeehut
Copy link

Jeehut commented Jul 8, 2014

I'm using v2.0.0 and I want to change the disable state of my rows programmatically without reloading the view. But when I do this the rows stay in their previous state. This happens both when I set disabled to YES or to NO.

Once I change the view or scroll the table view down so that some rows are not visible any more and I scroll back then those rows that were invisible for a moment are correctly disabled/enabled.

How can I make everything work without the need to scroll? Any workaround for me to quick-fix this thing? Also I think this is an issue with XLForm and should be fixed within the framework long-term.

Here are three screenshots, when I change the state of the "Availability" switch then all other rows should get enabled/disabled. On the first screenshot everything is fine. On the second I have enabled the switch so everything else should be disabled but it doesn't work. And on the third one you can see the state after scrolling down and up again.

ios simulator bildschirmfoto 08 07 2014 19 06 17
ios simulator bildschirmfoto 08 07 2014 19 06 23
ios simulator bildschirmfoto 08 07 2014 19 06 37

Thank you for your help!

@Jeehut Jeehut changed the title I'm using Disable State not working when changed programmatically Jul 8, 2014
@Jeehut Jeehut changed the title Disable State not working when changed programmatically Disable state on rows not working when changed programmatically Jul 8, 2014
@Jeehut
Copy link
Author

Jeehut commented Jul 8, 2014

I found a workaround myself. This code did the trick for me:

- (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)formRow oldValue:(id)oldValue newValue:(id)newValue
{
    // custom code ...
    [self.tableView reloadData];
}

@mtnbarreto
Copy link
Member

@Dschee this is the way. You can also reload just the section 1 of the table view.

In addition to this, there is a helper to reload a XLFormRowDescriptor -(void)reloadFormRow:(XLFormRowDescriptor *)formRow.

-(void)reloadFormRow:(XLFormRowDescriptor *)formRow
{
    NSIndexPath * indexPath = [self.form indexPathOfFormRow:formRow];
    if (indexPath){
        [self.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
    }
}

Anyway in your case reload the entire table or the relevant section is easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants