紧急求助!!ExtJS Xtemplate的问题 本帖最后由 panjianjun5 于 2012-12-24 10:28:19 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Ext.define('Ext.data.soap.Proxy', { extend: 'Ext.data.proxy.Ajax', alias: 'proxy.soap', requires: [ 'Ext.data.soap.Reader' ], operationParam: 'op',reader: 'soap',envelopeTpl: [ '<?xml version="1.0" encoding="utf-8" ?>', '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">', '{[values.bodyTpl.apply(values)]}', '</soap:Envelope>' ],readBodyTpl: [ '<soap:Body>', '<{operation} xmlns="{targetNamespace}">', '<tpl foreach="params">', '<{$}>{.}</{$}>', '</tpl>', '</{operation}>', '</soap:Body>' ],writeBodyTpl: [ '<soap:Body>', '<{operation} xmlns="{targetNamespace}">', '<tpl for="records">', '{% var recordName=values.modelName.split(".").pop(); %}', '<{[recordName]}>', '<tpl for="fields">', '<{name}>{[parent.get(values.name)]}</{name}>', '</tpl>', '</{[recordName]}>', '</tpl>', '</{operation}>', '</soap:Body>' ],constructor: function(config) { this.callParent(arguments); this.api = config.api || {}; this.soapAction = config.soapAction || {}; }, doRequest: function(operation, callback, scope) { var me = this, XTemplate = Ext.XTemplate, action = operation.action, soapOperation = me.api[action], params = Ext.applyIf(operation.params || {}, me.extraParams || {}), bodyTplName = action + 'BodyTpl', xmlData = XTemplate.getTpl(me, 'envelopeTpl').apply({ operation: soapOperation, targetNamespace: me.targetNamespace, params: params, records: operation.records, bodyTpl: XTemplate.getTpl(me, me[bodyTplName] ? bodyTplName : 'writeBodyTpl') }), request = new Ext.data.Request({ url: me.url + '?' + me.operationParam + '=' + soapOperation, method: 'POST', action: action, operation: operation, xmlData: xmlData, headers: Ext.apply({ SOAPAction: me.soapAction[action] }, me.headers), timeout: me.timeout, scope: me, disableCaching: false // explicitly set it to false, ServerProxy handles caching }); request.callback = request.callback = function(response,opts){ console.log(action); console.log(soapOperation); console.log(params); console.log(bodyTplName); console.log(xmlData); console.log(me[bodyTplName]); };//me.createRequestCallback(request, operation, callback, scope); Ext.Ajax.request(request); return request; }}); 找到问题了,是因为我用的是4.1.1的SDK,但是我下载的Proxy和Reader是4.1.3的,我用4.1.3的XTempalteCompiler就行了 菜鸟提问 数据库存入的HTML标签 如何还原显示出来 怎么在我自己的网页上显示google的提示 js鼠标经过图片放大问题 js 读文件 相对路径 ajax 用javascript怎么获得上一个页面表单提交的数据? 如何去掉页面提交是发出的声音? 我现在想在alert事件后,如果用户点击确定后,不再执行 href的连接,应该怎么写check 函数?谢谢各位相助!! 如何制作一个简单的滚动新闻? 這個問題有點難啊,高手菜鳥都可來看的.嘻嘻 Dialog弹出层 弹不出来,求指教 XML文档写入数据和修改数据不成功会有哪些原因?(代码如下)
extend: 'Ext.data.proxy.Ajax',
alias: 'proxy.soap', requires: [
'Ext.data.soap.Reader'
],
operationParam: 'op',
reader: 'soap',
envelopeTpl: [
'<?xml version="1.0" encoding="utf-8" ?>',
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">',
'{[values.bodyTpl.apply(values)]}',
'</soap:Envelope>'
],
readBodyTpl: [
'<soap:Body>',
'<{operation} xmlns="{targetNamespace}">',
'<tpl foreach="params">',
'<{$}>{.}</{$}>',
'</tpl>',
'</{operation}>',
'</soap:Body>'
],
writeBodyTpl: [
'<soap:Body>',
'<{operation} xmlns="{targetNamespace}">',
'<tpl for="records">',
'{% var recordName=values.modelName.split(".").pop(); %}',
'<{[recordName]}>',
'<tpl for="fields">',
'<{name}>{[parent.get(values.name)]}</{name}>',
'</tpl>',
'</{[recordName]}>',
'</tpl>',
'</{operation}>',
'</soap:Body>'
],
constructor: function(config) {
this.callParent(arguments);
this.api = config.api || {};
this.soapAction = config.soapAction || {};
}, doRequest: function(operation, callback, scope) {
var me = this,
XTemplate = Ext.XTemplate,
action = operation.action,
soapOperation = me.api[action],
params = Ext.applyIf(operation.params || {}, me.extraParams || {}),
bodyTplName = action + 'BodyTpl',
xmlData = XTemplate.getTpl(me, 'envelopeTpl').apply({
operation: soapOperation,
targetNamespace: me.targetNamespace,
params: params,
records: operation.records,
bodyTpl: XTemplate.getTpl(me, me[bodyTplName] ? bodyTplName : 'writeBodyTpl')
}),
request = new Ext.data.Request({
url: me.url + '?' + me.operationParam + '=' + soapOperation,
method: 'POST',
action: action,
operation: operation,
xmlData: xmlData,
headers: Ext.apply({
SOAPAction: me.soapAction[action]
}, me.headers),
timeout: me.timeout,
scope: me,
disableCaching: false // explicitly set it to false, ServerProxy handles caching
}); request.callback = request.callback = function(response,opts){
console.log(action);
console.log(soapOperation);
console.log(params);
console.log(bodyTplName);
console.log(xmlData);
console.log(me[bodyTplName]);
};//me.createRequestCallback(request, operation, callback, scope); Ext.Ajax.request(request);
return request;
}
});