当前位置: 动力学知识库 > 问答 > 编程问答 >

extjs - Sencha Touch Vbox

问题描述:

I have below requirement of a page with sencha touch:

  1. A drop down of some options
  2. A question posted by users (length may vary big time)
  3. a text area to display get the answer
  4. Two buttons for submit and ignore

I am using vbox layout. Now the problem is I want the page to be fully scrollable instead of partial scrolls on dataview etc.

How can I achieve it. I have similar requirements for different screens.

Below is the code:

Ext.define('HCMDoctor.view.PFQuestion', {

extend : 'Ext.form.Panel',

xtype : 'PFQuestion',

id : 'pfView',

config : {

layout : {

type : 'vbox',

align : 'stretch'

},

flex : 1,

scrollable : true,

items : [{

xtype : 'container',

html : 'Public Forum Question'

}, {

xtype : 'selectfield',

store : 'CommunityWiseQuestions',

name : 'pfCommId',

id : 'pfCommId',

valueField : 'communityId',

displayField : 'displayFull'

}, {

store : 'PFQuestion',

xtype : 'dataview',

flex : 1,

id : 'pfQuestionHolder',

itemTpl : ['{discussionTitle}<br>{description}',

'<br>Posted in {postedInCommunityName}']

}, {

xtype : 'hiddenfield',

id : 'pfQuestionId',

name : 'pfQuestionId'

}, {

xtype : 'textareafield',

id : 'pfAnswer',

name : 'pfAnswer'

}, {

store : 'PFQuestion',

xtype : 'button',

text : 'Ignore',

id : 'ignorePFQuestion'

}, {

store : 'PFQuestion',

xtype : 'button',

text : 'Submit',

id : 'submitPFQuestion'

}

]

}

});

Thanks

网友答案:

onload of store iterate over records and in every iteration create panel with tpl by passing record data to it and add the panel to its parent. something like this:

var parentPanel = Ext.getCmp("pfView");
for(var i=0; i++; i<records.size){
    var mypanel = Ext.create("Ext.Panel", {
        data    : records[i]
    });
    parentPanel.add(myPanel);
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: