Skip to content
Snippets Groups Projects
Commit 2a5d7aa9 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

ExtJS 4.2: clean the code.

parent 6eb57275
No related branches found
No related tags found
No related merge requests found
......@@ -261,106 +261,6 @@ Ext.define('App.form.FormPanel', {
return;
}
}
/*
var i,
field,
fieldName,
form = this.getForm(),
msg = '',
records,
title;
switch (type) {
case 'response':
// invalid response from the server, HTTP 400, 500
Ext.Msg.alert(this.textError, this.textServerError);
break;
case 'remote':
// invalid response from the server, HTTP 400, 500
if (response.hasOwnProperty('xhr')) {
Ext.Msg.alert(this.textError, response.xhr.responseText);
return;
}
// valid answer from the server, HTTP 200
// but something went wrong in the server validation process, ...
// build error message
switch (typeof (response.errors)) {
case "string":
msg += response.errors;
msg += '<br>';
break;
case "object":
// A list
if (Ext.isArray(response.errors)) {
for (i = 0; i < response.errors.length; i += 1) {
msg += response.errors[i];
msg += '<br>';
}
break;
}
// A dictionary
// mark fields invalid
// concatenate error messages
for (fieldName in response.errors) {
if (response.errors.hasOwnProperty(fieldName)) {
field = form.findField(fieldName);
if (field) {
field.markInvalid(response.errors[fieldName]);
}
msg += response.errors[fieldName];
msg += '<br>';
}
}
break;
}
// inform the user
// Keep the store in synchronization with the database
records = arg;
switch (action) {
case 'create':
for (i = 0; i < records.length; i += 1) {
this.store.remove(records[i]);
}
msg += this.textCreateErrorAction;
msg += '<br>';
title = this.textCreateFailed;
break;
case 'destroy':
msg += this.textDeleteErrorAction;
msg += '<br>';
title = this.textDeleteFailed;
break;
case 'update':
for (i = 0; i < records.length; i += 1) {
records[i].reject();
}
msg += this.textUpdateErrorAction;
msg += '<br>';
title = this.textUpdateFailed;
break;
}
msg += this.textDbAction;
// inform the user
Ext.Msg.alert(title, msg);
break;
} */
},
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment