PDA

View Full Version : exception in restfull



alien3d
27 Jun 2010, 9:56 PM
store = new Ext.data.JsonStore({
autoDestroy: true,
url: 'trx_data.php',
remoteSort: true,
root: 'cop_lon_cat_sub_trx',
id: 'cop_lon_cat_sub_trx_uniqueId',
totalProperty: 'total',
proxy: proxyTrxCode,
idProperty: 'cop_lon_cat_sub_trx_uniqueId',
successProperty: 'success',
writer: writer,
baseParams: {
leaf_uniqueId: leaf_uniqueId
}, listeners: {
exception: function (DataProxy, type, action, options, response, arg) {
// only support create
//if(action=='create') {
if (action == 'create') {
var serverMessage = Ext.util.JSON.decode(response.responseText);
if (serverMessage.success == 'false') {
Ext.MessageBox.alert("Error", serverMessage.message);
}
}
if (action == 'read') {
Ext.MessageBox.alert("system", "apa ni pun error");
}
if (action == 'update') {
// kena ajax request latest reverse uniqueId update error limit 1
Ext.MessageBox.alert("system", "Sila lihat log terkini update error");
}
// if(action=='destroy' || action=='remove') {
// Ext.MessageBox.alert("system","Sila lihat log terkni untuk delete error");
// }
//}


}, write: function (DataProxy, action, data, response, Record, options) {
alert("ini dalam write" + action);
}, update: function (Store, record, operation) {
// alert(' i have been updated');
}, remove: function (Store, record, index) {

//alert("i have been remove Chak");

}
},

Do no consider a bug or not
1. When removed a record it take data value instead of idProperty.In my code i have to overide it.
2. exception only working on create.(For normal json reader, normal read work fine)(only not work using restfull api).In my code , i have to check which latest error sql and return via ajax.request .
3.when creating a new record,it create double record.So in my record i have to filter the first empty record
4.When cancel new record,the record hang.Press the add button.And it will show off lot of empty record.
Suggest Changes.


var editorTrxCode = new Ext.ux.grid.RowEditor({
saveText: 'Kemaskini',
destroyText: 'Hapus',
listeners: {
hide: function (p) {
var undefined;
undefined = 0;
var curr_store = this.grid.getStore();
var record = curr_store.getAt(0);



if (record.get('trx_uniqueId') == null) {
undefined = 0;
// alert("Empty Record");
} else {
// alert("ada record");
undefined = 1;
}
//alert("Current Index"+this.rowIndex);
if (!this.save && undefined == 0) {
// alert("True"+record.get('trx_uniqueId'));
curr_store.remove(curr_store.getAt(this.rowIndex));
}
this.save = false;
}