请问个问题,我用Extjs做了一个功能,
代码如下:
var Query = new Ext.data.Store({
reader : new Ext.data.JsonReader({
totalProperty : "results_Query",
root : "items_Query",
fields : [{
name : 'Name'
}, {
name : 'address'
}
]
}),
baseParams : {
'baseParams1' : "1111"
'baseParams2' :"hehe"
},
proxy : new Ext.data.HttpProxy({
url : 'Actionpayfeequery.action'
})
,
callback:QueryLoadCallBack()
});
Query.load(); function ds_tgdlLoadCallBack(){
alert('CallBack')
}
}
在java端我获得了数据,并且改变了baseParams当中的数值,
执行后返回的json:
{"baseParams1":"Test","baseParams2":"1234","items_Query":[{"address":"江南","Name":"名字"}],"results_Query":10}
现在就是想吧baseParams1的值"Test"提取出来用了很多方法也没有实现,请高手指点迷津
代码如下:
var Query = new Ext.data.Store({
reader : new Ext.data.JsonReader({
totalProperty : "results_Query",
root : "items_Query",
fields : [{
name : 'Name'
}, {
name : 'address'
}
]
}),
baseParams : {
'baseParams1' : "1111"
'baseParams2' :"hehe"
},
proxy : new Ext.data.HttpProxy({
url : 'Actionpayfeequery.action'
})
,
callback:QueryLoadCallBack()
});
Query.load(); function ds_tgdlLoadCallBack(){
alert('CallBack')
}
}
在java端我获得了数据,并且改变了baseParams当中的数值,
执行后返回的json:
{"baseParams1":"Test","baseParams2":"1234","items_Query":[{"address":"江南","Name":"名字"}],"results_Query":10}
现在就是想吧baseParams1的值"Test"提取出来用了很多方法也没有实现,请高手指点迷津
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="extjs/ext-all.js"></script>
<script>
Ext.onReady(function(){
var obj = new Ext.data.Record.create([{name:'Name'},{name:'address'}])
var Query = new Ext.data.Store({
reader : new Ext.data.JsonReader({
totalProperty : "results_Query",
root : "items_Query",
successProperty : "success"
},obj),
baseParams : {
'baseParams1' : "1111",
'baseParams2' : "hehe"
},
proxy : new Ext.data.HttpProxy({
url : 'Actionpayfeequery.action'
}),
autoLoad :false,
listeners : {
load :function(st){
alert(st.reader.jsonData.baseParams1);
},
loadexception:function(httpProxy, dataObject, response, exception){
alert(response.responseText)
for(e in exception){alert(exception[e])}
}
}
});
Query.load();
});</script>'Actionpayfeequery.action' 返回{
success:true,
baseParams1:"Test",
baseParams2:"1234",
results_Query:10,
items_Query:[{Name:"name",address:"address"}]
}