gpt4 book ai didi

javascript - extjs:将变量传递给 FormPanel

转载 作者:行者123 更新时间:2023-12-02 19:49:23 35 4
gpt4 key购买 nike

我有一个函数:

function saveToJ(feature) {
var str = new OpenLayers.Format.GeoJSON(out_options).write(feature, true);
str = str.replace(/,/g, ', ');
strObj = Ext.decode(str);
if(strObj.properties.name == null) {
...
} else {
if(!win) {
win = new Ext.Window({
title : "Edit",
items : [editPanel],
closeAction : 'hide'
});
}
win.show();
}
}
}

和一个面板:

var editPanel = new Ext.form.FormPanel({
width : 400,
defaults : {
width : 230
},
defaultType : 'textfield',

items : [{
fieldLabel : 'Name',
name : 'name',
allowBlank : false,
}],

buttons : [editSaveBtn, editDeleteBtn]

});

我想要做的是使用 strObj.properties.name 作为面板上字段的。但是 value: strObj.properties.name 给出了 strObj 未定义的错误。

strObjsaveToJ 函数外部声明。

我做错了什么?

最佳答案

在尝试打开窗口之前,您确定 strObj 本身不为空吗?如果它已经在范围内,您不必将其传递给 Ext.form 即可使用它。我将使用调试器并确保它不为空。

关于javascript - extjs:将变量传递给 FormPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9494640/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com