Tuesday, 15 May 2012

sencha touch 2 - Dynamic Number of Radio fields -


I am trying to create a multi-choice class where I pass in question and anywhere from 2 to 8 possible answers The user will have to choose one how can I cross my item dynamically in my class, and create a new radiofield for every possible answer? Here my current class is with two possible answers (red, white)

 Ext.define ('Sencha.view.question.QuestionTypeOne'), expand: 'extension', xtype: 'question-type - A ', Required: [' Ext.TitleBar '], Config: {Height:' 250px ', Width:' 250px ', Item: [{xtype:' fieldet ', Title:' What is your favorite color? ',': [{Name: 'color', value: 'red', label: 'red'}, {{name: 'red'}, default: {xtype: 'radiofield', labelweuth: '40% '}, { Name: 'color', value: 'white', label: 'white'}]}]}, start: function () {this.callParent (argument);}});  

And will it be added something like this?

 {xtype: 'question-type-a', // question: "what is your favorite color?", // items: []}   

< When creating a view for div class = "post-text" itemprop = "text">

question-type-a you can pass the list of questions / answers and start initialize In the function, you can iterate this data and add the item to the field, for this you need tap config q & amp; A visual square.

  var Question = Extension. ("Sencha.view.question.QuestionTypeOne", {q: "Blah blah blah", a: {"a1", "a2", "a3"}});   

Then start the function initialize: function () {this.callParent (arguments); Var question = this.config.q; Var answer = this.config.a; Var Container = this.down ('Fields'); // reply now and reply to all containers. (Northfield) Add; }

No comments:

Post a Comment