diff --git a/modules/backend/widgets/table/assets/js/table.datasource.client.js b/modules/backend/widgets/table/assets/js/table.datasource.client.js index edde54f1b..103649c37 100644 --- a/modules/backend/widgets/table/assets/js/table.datasource.client.js +++ b/modules/backend/widgets/table/assets/js/table.datasource.client.js @@ -25,7 +25,7 @@ if (dataString === null || dataString === undefined) throw new Error('The required data-data attribute is not found on the table control element.') - + this.data = JSON.parse(dataString) }; @@ -71,11 +71,10 @@ Client.prototype.createRecord = function(recordData, placement, relativeToKey, offset, count, onSuccess) { if (placement === 'bottom') { // Add record to the bottom of the dataset - this.data.push(recordData) - } else if (placement == 'above' || placement == 'below') { + } + else if (placement == 'above' || placement == 'below') { // Add record above or below the passed record key - var recordIndex = this.getIndexOfKey(relativeToKey) if (placement == 'below') recordIndex ++ @@ -98,8 +97,10 @@ if (recordIndex !== -1) { recordData[this.tableObj.options.keyColumn] = key this.data[recordIndex] = recordData - } else + } + else { throw new Error('Record with they key '+key+ ' is not found in the data set') + } } /* @@ -124,8 +125,10 @@ this.data.push(newRecordData) this.getRecords(offset, count, onSuccess) - } else + } + else { throw new Error('Record with they key '+key+ ' is not found in the data set') + } } Client.prototype.getIndexOfKey = function(key) {