Filtering for the form

Thread is closed for posting
4 posts, 1 answers
  1. Jeff
    Jeff avatar
    12 posts
    Member since:
    Apr 2014

    Posted 16 Jan Link to this post

    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?

  2. Answer
    Todor
    Admin
    Todor avatar
    798 posts

    Posted 19 Jan Link to this post

    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.
  3. Jeff
    Jeff avatar
    12 posts
    Member since:
    Apr 2014

    Posted 19 Jan in reply to Todor Link to this post

    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

  4. Todor
    Admin
    Todor avatar
    798 posts

    Posted 19 Jan Link to this post

    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.
Back to Top