复制代码 代码如下:
{"type":"rpc","tid":2,"action":"Sample","method":"SaveForm","result":"{/"firstName/":/"4/",/"lastName
/":/"4/",/"age/":4}"}
复制代码 代码如下:
Ext.override(Ext.data.DirectProxy, {
createCallback: function(action, reader, cb, scope, arg) {
return {
callback: (action == 'load') ? function(result, e) {
if (typeof result == 'string') {
result = Ext.decode(result);
}
if (!e.status) {
this.fireEvent(action + "exception", this, e, result);
cb.call(scope, null, arg, false);
return;
}
var records;
try {
records = reader.readRecords(result);
}
catch (ex) {
this.fireEvent(action + "exception", this, e, result, ex);
cb.call(scope, null, arg, false);
return;
}
this.fireEvent(action, this, e, arg);
cb.call(scope, records, arg, true);
} : function(result, e) {
if (typeof result == 'string') {
result = Ext.decode(result);
}
if (!e.status) {
this.fireEvent(action + "exception", this, e);
cb.call(scope, null, e, false);
return;
}
this.fireEvent(action, this, result, e, arg);
cb.call(scope, result, e, true);
},
scope: this
}
}
});
复制代码 代码如下:
if (response.Result.GetType().ToString() == "Newtonsoft.Json.Linq.JObject" )
{
JObject o = new JObject (
new JProperty ("type" ,response.Type),
new JProperty ("tid" ,response.TransactionId),
new JProperty ("action" ,response.Action),
new JProperty ("method" ,response.Method),
new JProperty ("result" ,(JObject )response.Result)
);
return o.ToString();
}
else
{
return JsonConvert .SerializeObject(response);
}
复制代码 代码如下:
[DirectMethod ]
public object GetGridDatas()
{
JArray ja = new JArray ();
for (int i = 0; i < 2; i++)
{
ja.Add(new JObject (
new JProperty ("id" ,i),
new JProperty ("title" ,"title" +i.ToString())
));
}
JObject o = new JObject (
new JProperty ("results" , 2),
new JProperty ("rows" , ja)
);
return o;
}
新闻热点
疑难解答
图片精选