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

Filtering for the form

3 Answers 34 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.
Jeff
Top achievements
Rank 1
Jeff asked on 17 Jan 2017, 03:33 AM

Hi Telerik,

I am working on dataform. Is it possible to filter the dataSource after the selection.

e.g. I select Set A for lunch and set A only come with tea (set.png)

Then the second editor will filter out other options except tea (drink.png)

Or this is not a good way to use the dataform?

3 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 19 Jan 2017, 09:42 AM
Hi Jeff,

Thank you for your question.

This is a good scenario with data form. You can use the TKDataFormDelegate's methods dataForm:didEditProperty; dataForm:didCommitProperty or dataForm:willCommitProperty depending on your needs. Here's a sample implementation with the first of them:

- (void)dataForm:(TKDataForm *)dataForm didEditProperty:(TKEntityProperty *)property
{
    if([property.name isEqualToString:@"section"]) {
        TKEntityProperty* relatedProperty = _dataSource[@"table"];
        if((NSNumber*)property.valueCandidate < [NSNumber numberWithInteger:1]) {
            relatedProperty.valuesProvider = @[ @1, @2, @3, @4, @5, @6 ];
        } else {
            relatedProperty.valuesProvider = @[ @7, @8, @9, @10, @11, @12 ];
        }
        [dataForm updateEditorForProperty:relatedProperty];
    }
}

In this example depending on the selection of the property section, the values of the property table are changed.

Please note that there was an issue with the updating of the editor values which was fixed with the yesterday's release of UI for iOS (2017.1.118), so make sure you update before testing the above code.

I hope this information helps.

Regards,
Todor
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
Jeff
Top achievements
Rank 1
answered on 19 Jan 2017, 10:19 AM

Hi Todor,

Thank you for your help. I have tested the above methods, didComment / willComment, valuesProvider from dataSource[@"drink"] is updated but the editor can't. If I add [dataForm reload] in the end of didComment / willComment, the editor is updated but the dataForm will be closed.

Thanks

0
Todor
Telerik team
answered on 19 Jan 2017, 11:10 AM
Hi Jeff,

As I mentioned in the previous post, you will need the updated version of UI for iOS (2017.1.118) in order to make the update work.

Regards,
Todor
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
Jeff
Top achievements
Rank 1
Answers by
Todor
Telerik team
Jeff
Top achievements
Rank 1
Share this question
or