【问题标题】:Can we use Grid inside Sencha Container?我们可以在 Sencha Container 中使用 Grid 吗?
【发布时间】:2014-01-24 22:51:30
【问题描述】:

我想显示一份煎茶店的清单。我想将它显示为带有标题的表格,因此我认为 Grid 非常适合它。但是我收到了这个错误

Uncaught TypeError: Cannot call method 'substring' of undefined

是不是因为我使用 Grid 作为容器中的一个项目?如果不是什么问题,我怎样才能实现我的目标?

我已将 Grid 注释掉。我使用“列表”来显示记录,但由于我想在列表中添加标题,我认为 Grid 会更容易做到这一点。

'Ext.define("PocketCRM.view.InvestorsList", { 扩展:“Ext.Container”, 要求:[ "Ext.dataview.List", ], 别名:“widget.investorslistview”, 配置:{ 布局: { 类型:“vbox”,

    },
    items: [
        {
            xtype: "toolbar",
            docked: "top",
            title: "Investor Details",

            items: [
                {
                    xtype: "button",
                    ui: "back",
                    text: "Back",
                    itemId: "backToDeal"
                }
               ]
        },
        {
            xtype: "label",
            html: "Select a Client Area"
        },
        { 
            xtype: "list",                
            store: "Investors",
            itemId : "InvestorsList",
            onItemDisclosure: true,
            indexBar: false,
            grouped: false,
            disableSelection: false,
            loadingText: "Loading Investors...",
            emptyText: '<div class="leads-list-empty-text">No Investors found.</div>',
             itemCls : "dataview-item",
             itemTpl:[
                '<table border="0" cellpadding="2" cellspacing="2" style="width:95%; margin-top:0px;"><tr>',
                '<td style="width:20%; text-align: center; line-height: 3;  font-size: 16px;">{Account__c}</td>',
                '<td style="width:20%; text-align: center; line-height: 3;  font-size: 16px;">{Primary_Contact_Name__c}</td>',
                '<td style="width:20%; text-align: center; line-height: 3;  font-size: 16px;">{Status__c}</td>',
                '<td style="width:15%; text-align: center; line-height: 3;  font-size: 16px;">{Contact_Phone__c}</td>',
                '<td style="width:20%; text-align: center; line-height: 3;  font-size: 16px;">{Primary_Contact_Email__c}</td>',
                '</tr></table>'
               ],
            listeners : {
                    scope : this,
                    itemtap : function(dataview, index, el, record, e){
                        //Browser event e
                        console.log(e.target,Ext.get(e.target).getAttribute('id'));
                        var formPanel = Ext.create('Ext.form.Panel',{
                             modal : true,
                            hideOnMaskTap : true,
                            centered : true,
                            scrollable : 'vertical',
                            width : 400,
                            height : 200,
                            layout: { type: 'vbox', align: 'stretch' },
                            items:[{
                                xtype: 'selectfield',
                                name: 'Status__c',
                                label: 'Status',
                                options: [ 
                                     {text: 'Pending', value: 'Pending'}, 
                                     {text: 'Accepted', value: 'Accepted'}, 
                                     {text: 'Final Bidder', value: 'Final Bidder'},
                                     {text: 'Dropped', value: 'Dropped'},
                                     {text: 'Rejected', value: 'Rejected'}, 
                                     {text: 'Closed', value: 'Closed'} 
                                 ]
                                 },
                                 {xtype: 'spacer'},
                                 {xtype: 'spacer'},
                                 {
                                    xtype: 'button',
                                    //width : 100,
                                    text: 'Save',
                                    handler: function(){
                                        console.log('Inside Save');
                                        var InvStore = Ext.getStore('Investors');
                                        InvStore.sync();
                                        console.log('Completed Sync');
                                        formPanel.hide();
                                    }
                                 },
                                 {xtype: 'spacer'},
                                 {
                                    xtype: 'button',
                                    text: 'Cancel',
                                    //width : 100,
                                    handler: function(){
                                        formPanel.hide();
                                    }
                                 }]

                        });
                        formPanel.setRecord(record);
                        Ext.Viewport.add(formPanel).show();
                    }
                }

        },
        {
            //xtype: "grid.panel",
            //columns: [
              //  {text: 'Account',  dataIndex:'Account__c'},

            //],

        },
        ],
        listeners: [
        {
            delegate: "#backToDeal",
            event: "tap",
            fn: "onBackDealTap"
        },
        {        
        delegate: "#InvestorsList",
        event: "disclose",
        fn: "onInvestorsListDisclose"
        }
    ]
},'

【问题讨论】:

  • 亲爱的朋友,在这里,在 StackOverflow 中,如果没有您尝试过的示例代码,我们不明白您想要什么。因此,没有人愿意回答您的问题!
  • @OğuzÇelikdemir。各位大神能给个建议好吗?只是您认为可能会有所帮助。
  • 亲爱的 Georg,请复制 + 粘贴您的代码。这样我们就帮不了你了!
  • 是的。我会这样做@OğuzÇelikdemir。谢谢你帮助我。

标签: mobile extjs sencha-touch sencha-touch-2


【解决方案1】:

xtype 不是grid.panel,它只是grid

相关文档链接:http://docs.sencha.com/touch/2.3.1/#!/api/Ext.grid.Grid

【讨论】:

  • 我收到指向 Grid.js 文件的“意外令牌
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-31
相关资源
最近更新 更多