datastore.save()后,httpProxy 老会触发exception那个事情 查看返回res的参数,staus:200
responseText 也是服务器端返回的数据 但write事情不能触发 文档说这种问题是,reader不通解析json造成的,但我改了那个返回的json N多次,也还是出现那个问题,希望
弄过这一块儿的高手帮忙解决一下
responseText 也是服务器端返回的数据 但write事情不能触发 文档说这种问题是,reader不通解析json造成的,但我改了那个返回的json N多次,也还是出现那个问题,希望
弄过这一块儿的高手帮忙解决一下
解决方案 »
- 弱弱地问一下什么叫鼠标悬浮于页面的某个热点之上
- 求助 循环输出删除时函数参数的问题
- jqery隐藏没有设置属性的层
- js文件编码问题,请问怎么解决 急急急
- 这段js是什么意思,有外国字,有点看不懂,js也是新手,麻烦了,我把分都给你
- window.open('a.aspx','popupWin')弹出新窗口中值如何传回主窗口?
- Extjs Grid 分页的一个诡异问题求解
- 为什么不能动态 元素 !!!!!!! 急!!!!!!!!!!
- prompt中怎么样把我的密码"password"以"********"的形式体现出来!
- 希望将input中type为text的value从客户端读入,然后写到F盘中,用的是火狐浏览器,为什么不能实现呢?
- 第二次单击无效
- canvas 文字淡出
那个代码其实都有的
/*!
* Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* [email protected]
* http://www.extjs.com/license
*/
// Application instance for showing user-feedback messages.
var App = new Ext.App({});// Create a standard HttpProxy instance.
var proxy = new Ext.data.HttpProxy({
url: 'app.php/users'
});// Typical JsonReader. Notice additional meta-data params for defining the core attributes of your json-response
var reader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'id',
root: 'data',
messageProperty: 'message' // <-- New "messageProperty" meta-data
}, [
{name: 'id'},
{name: 'email', allowBlank: false},
{name: 'first', allowBlank: false},
{name: 'last', allowBlank: false}
]);// The new DataWriter component.
var writer = new Ext.data.JsonWriter({
encode: false // <-- don't return encoded JSON -- causes Ext.Ajax#request to send data using jsonData config rather than HTTP params
});// Typical Store collecting the Proxy, Reader and Writer together.
var store = new Ext.data.Store({
id: 'user',
restful: true, // <-- This Store is RESTful
proxy: proxy,
reader: reader,
writer: writer // <-- plug a DataWriter into the store just as you would a Reader
});// load the store immeditately
store.load();////
// ***New*** centralized listening of DataProxy events "beforewrite", "write" and "writeexception"
// upon Ext.data.DataProxy class. This is handy for centralizing user-feedback messaging into one place rather than
// attaching listenrs to EACH Store.
//
// Listen to all DataProxy beforewrite events
//
Ext.data.DataProxy.addListener('beforewrite', function(proxy, action) {
App.setAlert(App.STATUS_NOTICE, "Before " + action);
});////
// all write events
//
Ext.data.DataProxy.addListener('write', function(proxy, action, result, res, rs) {
App.setAlert(true, action + ':' + res.message);
});////
// all exception events
//
Ext.data.DataProxy.addListener('exception', function(proxy, type, action, options, res) {
App.setAlert(false, "Something bad happend while executing " + action);
});// Let's pretend we rendered our grid-columns with meta-data from our ORM framework.
var userColumns = [
{header: "ID", width: 40, sortable: true, dataIndex: 'id'},
{header: "Email", width: 100, sortable: true, dataIndex: 'email', editor: new Ext.form.TextField({})},
{header: "First", width: 50, sortable: true, dataIndex: 'first', editor: new Ext.form.TextField({})},
{header: "Last", width: 50, sortable: true, dataIndex: 'last', editor: new Ext.form.TextField({})}
];
Ext.onReady(function() {
Ext.QuickTips.init(); // use RowEditor for editing
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
}); // Create a typical GridPanel with RowEditor plugin
var userGrid = new Ext.grid.GridPanel({
renderTo: 'user-grid',
iconCls: 'icon-grid',
frame: true,
title: 'Users',
autoScroll: true,
height: 300,
store: store,
plugins: [editor],
columns : userColumns,
tbar: [{
text: 'Add',
iconCls: 'silk-add',
handler: onAdd
}, '-', {
text: 'Delete',
iconCls: 'silk-delete',
handler: onDelete
}, '-'],
viewConfig: {
forceFit: true
}
}); /**
* onAdd
*/
function onAdd(btn, ev) {
var u = new userGrid.store.recordType({
first : '',
last: '',
email : ''
});
editor.stopEditing();
userGrid.store.insert(0, u);
editor.startEditing(0);
}
/**
* onDelete
*/
function onDelete() {
var rec = userGrid.getSelectionModel().getSelected();
if (!rec) {
return false;
}
userGrid.store.remove(rec);
}});
我想知道,在update和destroy的时候,怎么促发的到后台呢?
new Ext.data.HttpProxy({
api: {
read:'read.jsp',
create: 'create.jsp',
update: 'update.jsp',
destroy: 'destroy.php'
}});
默认的话,update是put,提示403错误,destroy是delete,提示405错误,如果该成post或者get提示404错误,因为他把我的主键也就是ID直接加在了URL后面变成了update.jsp/10001的格式。
不知道能不能提供一些帮助的,谢谢了。