Show a option list in valuesProvider, with 3 or less elements.

Thread is closed for posting
3 posts, 1 answers
  1. Jesús
    Jesús avatar
    7 posts
    Member since:
    Feb 2013

    Posted 02 Mar Link to this post

    Hello!

    I need some help showing a list of elements in my DataForm. Originally i created a funcionallity based on a option list (NSInteger property of my BO) that has many elements to display (lets say 10). Then, this option list has been reduced to show only 2 elements. Unfortunelly, in my DataForm this option list is replaced by an segmented control (i think because is less than 4 elements, the minimum that shows an option list), and because of that, all my work with the data form is not used. So i would like to know if there is a way to use a option list by default for 3 or less elements in valuesProvider. And how can i achieve it?

    Greetings!

  2. Answer
    Todor
    Admin
    Todor avatar
    798 posts

    Posted 07 Mar Link to this post

    Hello Jesús,

    Thank you for your interest in DataForm for iOS.

    Your observation is correct that when your list of values contains less than 4 elements the default editor is TKDataFormSegmentedEditor. You can easily set your preferred editor through the editorClass property:

    _dataSource[@"myProperty"].valuesProvider = @[@"Option 1", @"Option 2", @"Option 3"];
    _dataSource[@"myProperty"].editorClass = [TKDataFormOptionsEditor class];

    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. Jesús
    Jesús avatar
    7 posts
    Member since:
    Feb 2013

    Posted 07 Mar in reply to Todor Link to this post

    So easy and so helpful. 

    Just added the last line to mi property and it works!

    Thanks a lot, Todor!

Back to Top