EXT 的问题,把JsonStore里的数据显示到FormPanel里
发布网友
发布时间:2024-10-02 16:56
我来回答
共1个回答
热心网友
时间:2024-10-04 11:41
你可以用formpanel的load事件,load成功的话,会按照formpanel上控件的name属性,自动赋值上去
官方的例子:
var myFormPanel = new Ext.form.FormPanel({
title: 'Client and routing info',
items: [{
fieldLabel: 'Client',
name: 'clientName'
}, {
fieldLabel: 'Port of loading',
name: 'portOfLoading'
}, {
fieldLabel: 'Port of discharge',
name: 'portOfDischarge'
}]
});
myFormPanel.getForm().load({
url: '/getRoutingInfo.php',
params: {
consignmentRef: myConsignmentRef
},
failure: function(form, action) {
Ext.Msg.alert("Load failed", action.result.errorMessage);
}
});
//成功返回时的json例子
{
success: true, //告诉formpanel取值成功
data: { //数据
clientName: "Fred. Olsen Lines",
portOfLoading: "FXT",
portOfDischarge: "OSL"
}
}