This is a migrated thread and some comments may be shown as answers.

Show properties from a selected option

3 Answers 31 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jesús
Top achievements
Rank 1
Jesús asked on 21 Dec 2016, 11:34 PM
Hello! I think that this is easy to achieve, but i cannot find the way. So here's the question: I have a main view that contains a editor which shows a list of 10 options. When i select a option the navigation returns to main view and, depending on the option selected want to show a group of properties of that option. The problem is that i cannot find a way to hide or show the group when i return to the main view. I've tried with the updateEditor Delegate Method, but at least just can hide the group of my dataSource. ([[self.dataSource.groups objectAtIndex:0]setHidden:YES]) Hope that anyone can help me. Greetings.

3 Answers, 1 is accepted

Sort by
0
Accepted
Adrian
Telerik team
answered on 23 Dec 2016, 01:20 PM
Hello Jesus,

Thank you for contacting us.

You can achieve this by implementing TKDataFormDelegate's dataForm:didEditProperty: method where you should set the hidden property of the group like in the code from your post. However this will mark the group as hidden in the TKDataFormEntityDataSource, so you should also call the data form's reloadData method. This will make the data form request the updated information from the data source. You should call reload data when the view with the data form is ready to be shown on screen. A possible place is viewWillAppear. Consider the code below:
- (void)viewWillAppear:(BOOL)animated {
    if (_shouldReloadData) {
        _shouldReloadData = NO;
        [self.dataForm reloadData];
    }
}
 
- (void)dataForm:(TKDataForm *)dataForm didEditProperty:(TKEntityProperty *)property {
    if ([property.name isEqualToString:@"encryptionLevel"]) {
        [_dataSource groupAtIndex:0].hidden = YES;
        _shouldReloadData = YES;
    }
}

I hope this helps.

Regards,
Adrian
Telerik by Progress
Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
0
Jesús
Top achievements
Rank 1
answered on 23 Dec 2016, 04:43 PM
This works like a charm! Thanks Adrian, thanks a lot :)
0
Adrian
Telerik team
answered on 27 Dec 2016, 09:45 AM
Hi,

I am glad that I could help. Since the issue is solved I'm closing this thread. If you need further assistance do not hesitate to contact us again.

Regards,
Adrian
Telerik by Progress
Want to build beautiful Android apps as well? Check out UI for Android which enables the same set of scenarios, allowing you to create the same great app experience on both iOS and Android.
Tags
DataForm
Asked by
Jesús
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Jesús
Top achievements
Rank 1
Share this question
or