Dynamic Fields

7 posts, 0 answers
  1. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jun 2016

    Posted 14 Jun Link to this post

    Does DataForm support adding dynamic fields that won't be known until runtime? I can't statically put them as properties for an object and pass that for the datasource initialization because I have fields that will only be known during runtime.
  2. Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 17 Jun Link to this post

    Hello Ryan,

    Does your scenario include loading remote data or loading data from files? Could you, please, give us more details about what you are aiming to achieve with the TKDataForm, this way we can assist you and provide you with proper solution in short terms.

    Looking forward to hearing from you.

    Regards,
    Sophi
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jun 2016

    Posted 17 Jun in reply to Sophi Link to this post

    I am loading remote data. I will not know what the field names are until runtime because the fields are dynamically created by somebody else. What I want to do is load all of these fields and add them to the dataform. Currently I have a static section where I will know all of the fields statically before runtime and so I am passing in an object to my DataSource so that DataForm can present these fields in which I statically know the field names before runtime. However I also have a dynamic fields section that I will not know until runtime. I need to add these dynamic fields to the data form.
  5. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jun 2016

    Posted 17 Jun in reply to Ryan Link to this post

    These dynamic fields will come back from my web service as a dictionary with keys and values. The key is the field name and the value is what to display. How can I add this to the dataform?
  6. Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 21 Jun Link to this post

    Hello Ryan,

    TKDataForm allows you to change the sourceObject any time and just call the reloadData method of the TKDataForm. You can change the sourceObject at runtime with the updated one, or even create a new instance of the TKDataFormEntityDataSource with a sourceObject out of JSON input.

    You can refer to this example for the JSON support feature.

    Regards,
    Sophi
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  7. Ryan
    Ryan avatar
    25 posts
    Member since:
    Jun 2016

    Posted 08 Aug in reply to Sophi Link to this post

    Currently I am mapping a certain key path of my JSON to a source object but what I do is map the dynamic portion of my JSON (another keypath) to an NSDictionary. Is there a way for me to map one group of the data form to a source object and another group of the data form to JSON at a certain keypath (my dynamic portion of the JSON)?
  8. Sophi
    Admin
    Sophi avatar
    99 posts

    Posted 10 Aug Link to this post

    Hi Ryan,

    Currently the TKDataForm can be loaded only from a single source object or JSON. You cannot have different groups loaded from separate sources.
    When you get the remote data you should create a source object or feed directly the TKDataForm with NSDictionary or JSON file and then reload it by calling the reloadData method.

    Regards,
    Sophi
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner