【问题标题】:Sencha Touch Vbox煎茶触控Vbox
【发布时间】:2013-06-25 16:57:26
【问题描述】:

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

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

            ]

        }
    });

谢谢

【问题讨论】:

  • 为什么pfQuestionHolderdataview?它很可能是带有datatpl 属性的Panel 来实现您想要的。
  • 当你说数据时,你的意思是它是硬编码的吗?我需要来自服务器的数据...如果您可以建议我使用带有商店或应用商店数据的面板的方法,我完全没问题。

标签: extjs sencha-touch


【解决方案1】:

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

【讨论】:

  • 非常感谢 ThinkFloyd。你有没有办法以类似的方式填写一个列表?或者有一个带有for循环的模板并传递数组是合适的??
  • 由于列表使用存储中的数据,您可以在存储中添加记录并刷新,它应该可以工作
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多