mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX: TableField? delete link should not trigger a ajax request if the record row is not a real record. (merged from branches/2.3-nzct)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@82066 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1f19dcdfad
commit
cc11d6e2d4
@ -51,12 +51,13 @@ TableField.prototype = {
|
|||||||
var row = Event.findElement(e,"tr");
|
var row = Event.findElement(e,"tr");
|
||||||
var params = link.getAttribute("href").toQueryParams();
|
var params = link.getAttribute("href").toQueryParams();
|
||||||
var isEmpty = true;
|
var isEmpty = true;
|
||||||
|
var recordID = row.getRecordId();
|
||||||
|
|
||||||
// Check to see if there is a dataobject to delete first, otherwise remove the row.
|
// Check to see if there is a dataobject to delete first, otherwise remove the row.
|
||||||
// or: Check if a childID is set (not present on new items)
|
// or: Check if a childID is set (not present on new items)
|
||||||
if(
|
if(
|
||||||
(this.hasNoValues(row,"input") && this.hasNoValues(row,"select") && this.hasNoValues(row,"textarea"))
|
(this.hasNoValues(row,"input") && this.hasNoValues(row,"select") && this.hasNoValues(row,"textarea"))
|
||||||
|| params["childID"] <= 0
|
|| params["childID"] <= 0 || (recordID <= 0 || recordID == false)
|
||||||
){
|
){
|
||||||
if( row.parentNode.getElementsByTagName('tr').length > 1 ) {
|
if( row.parentNode.getElementsByTagName('tr').length > 1 ) {
|
||||||
try { Effect.FadeOut(row); } catch (e) {
|
try { Effect.FadeOut(row); } catch (e) {
|
||||||
@ -73,7 +74,7 @@ TableField.prototype = {
|
|||||||
Event.stop(e);
|
Event.stop(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
// TODO ajaxErrorHandler and loading-image are dependent on cms, but formfield is in sapphire
|
||||||
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE', 'Are you sure you want to delete this record?'));
|
var confirmed = confirm(ss.i18n._t('TABLEFIELD.DELETECONFIRMMESSAGE', 'Are you sure you want to delete this record?'));
|
||||||
if(confirmed){
|
if(confirmed){
|
||||||
|
@ -290,6 +290,12 @@ TableListRecord.prototype = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getRecordId: function(){
|
||||||
|
parts = this.id.match( /.*[\-]{1}(\d+)$/ );
|
||||||
|
if(parts) return parts[1];
|
||||||
|
else return false;
|
||||||
|
},
|
||||||
|
|
||||||
select_success : function(response) {
|
select_success : function(response) {
|
||||||
Element.removeClassName(this, 'loading');
|
Element.removeClassName(this, 'loading');
|
||||||
this.subform.loadNewPage(response.responseText);
|
this.subform.loadNewPage(response.responseText);
|
||||||
|
Loading…
Reference in New Issue
Block a user