Ext Js:动态添加嵌套面板

发布于 2024-11-30 09:19:08 字数 1771 浏览 1 评论 0原文

我有几条相同类型的记录想要在屏幕上显示。我考虑过创建几个面板来打印每条记录的数据。我选择这个解决方案是因为数据结构太复杂,无法在简单的网格中打印。这是该结构的一个简化示例:

{
    label: 'myLabel',
    {
        attr1: 'value1',
        attr2: 'value2'
    }
    startValidityDate: oneDay,
    endValidityDate: anotherDay
}

我尝试在当前面板中添加动态嵌套面板:

var myStore = new Ext.data.Store({
    id: 'myStore',
    restful: true,
    idProperty: 'OID',
    root: 'tbas',
    proxy: myProxy,
    reader: myReader,
    autoLoad: false, 
    listeners: {
        'load': function(data){
        var records = data.getRange();
        var currStore = null;
        for(var i=0; i<records.length; i++) {
            currStore = new Ext.Panel({
            layout:'vBox',
            items: [{
                xtype: 'textfield',
                fieldLabel: I18nManager.get('label_ttbaUI_label'),
                name: 'tbaLabel',
                value: records[i].data.tbaLabel
                },{
                xtype: 'textfield',
                fieldLabel: I18nManager.get('label_ttbaUI_label'),
                name: 'tbaOid',
                value: records[i].data.tbaoid
                }] 
            });
        recordList.add(currStore);
console.log("------------------------------");
console.log(currStore);
        }
        recordList.doLayout();
        }
    }
});

var recordList = new Ext.Panel({
    id: 'recordList',
    renderTo: 'recordPart',
    layout:'vBox',
    title: I18nManager.get('label_ttbaUI_selected_tariffs')
});
recordList.doLayout();

在 firebug 控制台中,UI 对象似乎没问题。

我的问题是 recordList 元素不可见,

我可以看到它们存在于 FB 控制台中,但它们没有很好地打印在屏幕上。

我是否忘记了一些使元素隐藏的东西?或者印刷不好? 我确信这是一个CSS问题,ext-all.css有些麻烦:当我删除该CSS的内容时,我可以看到我的字段

我编写代码的方式一定有问题,因此它会导致渲染问题WDYT ???

I have several records of the same type that I want to show on the screen. I thought about creating several panels that will print the data of each record. I chose this solution because data structure is too complex to be printed in a simple grid. Here is a simplified example of that structure :

{
    label: 'myLabel',
    {
        attr1: 'value1',
        attr2: 'value2'
    }
    startValidityDate: oneDay,
    endValidityDate: anotherDay
}

I try to add dynamically nested panels in my current panel :

var myStore = new Ext.data.Store({
    id: 'myStore',
    restful: true,
    idProperty: 'OID',
    root: 'tbas',
    proxy: myProxy,
    reader: myReader,
    autoLoad: false, 
    listeners: {
        'load': function(data){
        var records = data.getRange();
        var currStore = null;
        for(var i=0; i<records.length; i++) {
            currStore = new Ext.Panel({
            layout:'vBox',
            items: [{
                xtype: 'textfield',
                fieldLabel: I18nManager.get('label_ttbaUI_label'),
                name: 'tbaLabel',
                value: records[i].data.tbaLabel
                },{
                xtype: 'textfield',
                fieldLabel: I18nManager.get('label_ttbaUI_label'),
                name: 'tbaOid',
                value: records[i].data.tbaoid
                }] 
            });
        recordList.add(currStore);
console.log("------------------------------");
console.log(currStore);
        }
        recordList.doLayout();
        }
    }
});

var recordList = new Ext.Panel({
    id: 'recordList',
    renderTo: 'recordPart',
    layout:'vBox',
    title: I18nManager.get('label_ttbaUI_selected_tariffs')
});
recordList.doLayout();

In the firebug console, the UI objects seems to be ok.

My problem is that the recordList elements are not visible

I can see that they exist in the FB console, but they are not well printed on the screen.

Did I forgot something that make the elements hidden ? or bad printed ?
I'm sure that it is a CSS problem, some trouble with ext-all.css : when I remove the content of that CSS, I can see my fields

There must be something wrong in the way I wrote the code so that it causes the render problem WDYT ???

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文