2013-06-22 165 views
0

我有以下煎茶触摸页面的要求:煎茶触摸VBOX

  1. 一滴一些选项下
  2. 由用户发布(长度可以变化大的时候)
  3. 文本区域的一个问题显示得到的答案
  4. 两个按钮提交和忽略

我使用VBOX布局。现在的问题是,我希望页面可以完全滚动而不是部分数据视图上的滚动等。

我该如何实现它。我对不同的屏幕有类似的要求。

下面是代码:

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' 
        } 

      ] 

     } 
    }); 

感谢

+0

为什么'pfQuestionHolder'是'dataview'?它很可能是一个''Panel'' data''''tpl''属性来实现你想要的。 – ThinkFloyd

+0

当你说数据你的意思是硬编码?我需要来自服务器的数据...如果你能建议我有一个存储或应用商店数据面板的方法,我完全没问题。 –

回答

0

的onload店迭代过记录,并在每次迭代通过记录数据传递给它创建tpl面板和面板添加到其父。像这样:

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); 
} 
+0

非常感谢ThinkFloyd。你有没有办法以类似的方式来制作一个列表?或者使用for循环和传递数组的模板是合适的? –

+0

由于List使用商店中的数据,您可以在商店和刷新中添加记录,它应该可以工作 – ThinkFloyd