Results 1 to 4 of 4

Thread: Dynamically Populating XTypes

  1. #1
    Sencha User
    Join Date
    Apr 2007
    Posts
    138
    Answers
    1

    Default Answered: Dynamically Populating XTypes

    I need some help with dynamically populating some custom xtypes in my project. As you can see from the following Fiddle, items are being dynamically added to a carousel. However, each of the items are static. I need to be able to pass in the record data into the xtypes so that they become dynamic.

    For example, the first carousel card should read:

    Question 1
    Which city is the capital of New York
    ?

    After this I would like to populate a series of multiple choice answers from the store (the answers haven't been included in this example in order to simplify things for now).

    Any help would be appreciated.


  2. You'll need to loop over each of your answer options and create the config for the radiofield. Once you've created each config, add them to your fieldset.

    Regards,
    Brian

    https://fiddle.sencha.com/#fiddle/fnd

  3. #2
    Sencha User
    Join Date
    Apr 2007
    Posts
    138
    Answers
    1

    Default

    I came up with a clunky solution for part of this by breaking up the larger xtypes into smaller, less involved xtypes where I could define some of the variables. That takes care of the top part of each question (the question number and the question itself). However, I still need to determine how to dynamically parse through a list of potential answers (optionA, optionB, optionB, etc [see the getQuestions2 store in the Fiddle example]) and display the non-null options as radio buttons. Can anyone point me in the right direction on how to do that?


  4. #3
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781
    Answers
    102

    Default

    You'll need to loop over each of your answer options and create the config for the radiofield. Once you've created each config, add them to your fieldset.

    Regards,
    Brian

    https://fiddle.sencha.com/#fiddle/fnd

  5. #4
    Sencha User
    Join Date
    Apr 2007
    Posts
    138
    Answers
    1

    Default

    Quote Originally Posted by lumberjack View Post
    You'll need to loop over each of your answer options and create the config for the radiofield. Once you've created each config, add them to your fieldset.
    Thanks for the example. This put me on the right track. Much appreciated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •