Restful посылает POST вместо DELETE
добрый вечер, помогите разобраться почему при использовании restful он посылает метов POST, а не DELETE. вот код
function index(){
var reader = new Ext.data.JsonReader({
idProperty:'id',
fields: [
{ name: 'id', type: 'int' },
{ name: 'mark', type: 'string', allowBlank: false },
{ name: 'model', type: 'string' },
{ name: 'description', type: 'string' },
{ name: 'release_year', type: 'string' }
],
root:'data',
remoteGroup:false,
remoteSort: false
});
var writer = new Ext.data.JsonWriter({
encode: false
});
var editor = new Ext.ux.grid.RowEditor({
saveText: 'Update'
});
var ds = new Ext.data.GroupingStore({
autoDestroy: true,
reader: reader,
writer: writer,
restful: true,
proxy : new Ext.data.HttpProxy({
url: '/admin/cars.json'
}),
sortInfo: { field: 'id', direction: 'ASC' },
groupField: 'mark',
});
var grid = new Ext.grid.GridPanel({
width: 860,
height: 400,
frame: false,
renderTo: 'grid',
autoScroll: true,
plugins: [editor],
ds: ds,
columns: [
new Ext.grid.RowNumberer(),
{ header: 'id', dataIndex: 'id', id: 'id', sortable: false, width: 30 },
{ header: 'Mark', dataIndex: 'mark', sortable: true, width: 100,
editor: new Ext.form.TextField({ allowBlank: false }) },
{ header: 'Model', dataIndex: 'model', sortable: true, width: 100,
editor: new Ext.form.TextField({ allowBlank: false }) },
{ header: 'Description', dataIndex: 'description',
editor: new Ext.form.TextField({ allowBlank: false }) },
{ header: 'release_year', dataIndex: 'release_year' }
],
view: new Ext.grid.GroupingView({
forceFit: true,
showGroupName: false,
enableNoGroups: false,
enableGroupingMenu: false,
hideGroupedColumn: false,
groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
}),
tbar: [{
text: 'Add Car',
handler : onAdd
}, '-', {
text: 'Delete',
iconCls: 'silk-delete',
handler: onDelete
}, '-'],
viewConfig: {
forceFit: true
}
});
/**
* onAdd
*/
function onAdd(btn, ev) {
var m = new grid.store.recordType({
mark : '',
model: '',
description : '',
release_year : (new Date()).clearTime()
});
editor.stopEditing();
grid.store.insert(0, m);
editor.startEditing(0);
}
/**
* onDelete
*/
function onDelete() {
var rec = grid.getSelectionModel().getSelected();
if (!rec) {
return false;
}
grid.store.remove(rec);
}
grid.store.load();
}
Ext.onReady(index());
|