javascript - ExtJS PropertyGrid - 动态设置源

标签 javascript extjs propertygrid

我正在处理一个简单的 PropertyGrid。如果我在设计时使用一些 json 对象设置 source 属性,它会正确显示。但是当我尝试动态设置源数据时,它不显示数据。

这是我的代码:

ConceptPropertiesPanel = function() {

    this.source = {   ***// if i set source this way, it will work***

    "(name)": "My Object",
    "Created": new Date(Date.parse('10/15/2006')),  
    "Available": false,  
    "Version": .01,     
    "Description": "A test object"
};

ConceptPropertiesPanel.superclass.constructor.call(this, {
    id: 'concetp-properties',
    region: 'east',
    title: 'Concept Properties',
    autoScroll: true,
    margins: '0 5 0 0',
    split: true,
    width: 250,
    minSize: 250,
    maxSize: 400,
    collapsible: true,
    source: {}
})
};


Ext.extend(ConceptPropertiesPanel, Ext.grid.PropertyGrid, {

setSourceData: function(data) { **//I want to set source when the below method is called, but not working**
    this.setSource({
        "(name)": "My Object",
        "Created": new Date(Date.parse('10/15/2006')),  
        "Available": false,  
        "Version": .01,     
        "Description": "A test object"
    });
}

});

这就是我调用“setSourceData”函数的方式。

var conceptPropertiesPanel = new ConceptPropertiesPanel();
conceptPropertiesPanel.setSourceData(data);

谁能告诉我问题出在哪里?

最佳答案

Here是你的演示代码。它按预期工作。您可能需要在调用 conceptPropertiesPanel.setSourceData(data); 时检查是否存在任何 JS 错误,否则它应该工作!

关于javascript - ExtJS PropertyGrid - 动态设置源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1107404/

相关文章:

javascript - 调整大小的导航栏隐藏了网站内容

javascript - Javascript 在无限循环中获取 Document 对象

javascript - EXTJS范围问题

rest - Sencha touch 2 oauth2 身份验证

c# - 如何在属性网格中显示动态对象?

c++ - QtPropertyBrowser 和值更改信号

javascript - 从对象动态创建元素

javascript - CSS 不在 MVC 5 View For image-gallery 中的事件缩略图下方绘制边框

javascript - 多选组合框和 tpl - 在 Ext JS 中标记选定条目的问题

c# - InvalidCastException 将对象转换为它自己的类型