PDA

View Full Version : DataProxy attempted to execute an API-action but found an undefined url / function.



bryanevil
13 Jun 2010, 10:00 PM
Hi all

I am new to extjs, and I was trying to create a grid that can Add, Edit , Delete records. So far I was success on display, and edit records with the below code. However, I got this error when I try to delete record - "DataProxy attempted to execute an API-action but found an undefined url / function." And I couldnt find the problem.

Reader, writer, proxy, and store


var companyinfoProxy = new Ext.data.HttpProxy({
api:{
// Call web service method using GET syntax
read: '../WebServices/Account/CompanyService.asmx/GetAll',
create: '../WebServices/Account/CompanyService.asmx/Add',
update: '../WebServices/Account/CompanyService.asmx/Update',
destory: '../WebServices/Account/CompanyService.asmx/Delete'},
// Ask for Json response
headers: { 'Content-type': 'application/json' }
});
var companyinfoReader = new Ext.data.JsonReader({
totalProperty: 'total',
successProperty: 'success',
idProperty: 'ID',
root: 'd',
messageProperty: 'message',
// map to MonthlyReportDTO
fields: ['CompanyName', 'ID']

});
var companyinfoWriter = new Ext.data.JsonWriter({
encode: false,
writeAllFields: true,


});
var CompanyInfoJsonStore = new Ext.data.Store({
// Load data at once
autoLoad: true,
// Override default http proxy settings
proxy: companyinfoProxy,
reader: companyinfoReader,
writer: companyinfoWriter

});



// create the Grid
var grid = new Ext.grid.EditorGridPanel({
store: CompanyInfoJsonStore,
columns: CompanyColomn,
stripeRows: true,
autoExpandColumn: 'CompanyName',

height: 600,
title: 'Company List',
// config options for stateful behavior
stateful: true,
stateId: 'grid',
tbar: [{
id: 'Savebtn',
text: 'Save',
handler: function () {
CompanyInfoJsonStore.save();
},
scope:this
},
{
id: 'Delbtn',
text: 'Delete',
handler: function () {
var index = grid.getSelectionModel().getSelectedCell();
if(!index){
return false;
}
var rec =grid.store.getAt(index[0]);
grid.store.remove(rec);
}
}]
});
Grid:



// create the Grid
var grid = new Ext.grid.EditorGridPanel({
store: CompanyInfoJsonStore,
columns: CompanyColomn,
stripeRows: true,
autoExpandColumn: 'CompanyName',

height: 600,
title: 'Company List',
// config options for stateful behavior
stateful: true,
stateId: 'grid',
tbar: [{
id: 'Savebtn',
text: 'Save',
handler: function () {
CompanyInfoJsonStore.save();
},
scope:this
},
{
id: 'Delbtn',
text: 'Delete',
handler: function () {
var index = grid.getSelectionModel().getSelectedCell();
if(!index){
return false;
}
var rec =grid.store.getAt(index[0]);
grid.store.remove(rec);
}
}]
});
I debug in firebug and hit the error at this line of code ="grid.store.remove(rec);"

I have no clue whats wrong have i done. Could you give me help please. Thank you.

Regards
Bryan

Condor
13 Jun 2010, 10:26 PM
"destory"?

bryanevil
14 Jun 2010, 12:13 AM
"destory"?

I will never be good at my second language...