Skip to content
Snippets Groups Projects
Commit 901c25e4 authored by parkera's avatar parkera
Browse files

SSDM-3632 : Batch delete on sample table

SVN: 36639
parent e48f471b
No related branches found
No related tags found
No related merge requests found
......@@ -83,8 +83,8 @@ function SampleTableController(parentController, title, experimentIdentifier, pr
}
//Create and display table
var dataGridController = SampleDataGridUtil.getSampleDataGrid(selectedSampleTypeCode, samples, null, null, null, null, null, null, false);
dataGridController.init(this._sampleTableView.getTableContainer());
this._sampleTableView._dataGridController = SampleDataGridUtil.getSampleDataGrid(selectedSampleTypeCode, samples, null, null, null, null, null, null, true);
this._sampleTableView._dataGridController.init(this._sampleTableView.getTableContainer());
}
}
}
\ No newline at end of file
......@@ -128,6 +128,36 @@ function SampleTableView(sampleTableController, sampleTableModel) {
_this.updateSamples(_this._sampleTableModel.experimentIdentifier);
});
$list.append($batchUpdateOption);
var $batchDeleteOption = $("<li>", { 'role' : 'presentation' }).append($("<a>", {'title' : 'Delete Samples'}).append("Delete Samples"));
$batchDeleteOption.click(function() {
var grid = _this._dataGridController._grid;
var selected = grid.getSelected();
if(selected != undefined && selected.length == 0){
alert("Please select at least one sample to delete!");
}else{
var warningText = "The next samples will be deleted: ";
var sampleTechIds = [];
for(var sIdx = 0; sIdx < selected.length; sIdx++) {
sampleTechIds.push(selected[sIdx].id);
warningText += selected[sIdx].identifier + " ";
}
var modalView = new DeleteEntityController(function(reason) {
mainController.serverFacade.deleteSamples(sampleTechIds, reason, function(data) {
if(data.error) {
Util.showError(data.error.message);
} else {
Util.showSuccess("Sample/s Deleted");
mainController.refreshView();
}
});
}, true, warningText);
modalView.init();
}
});
$list.append($batchDeleteOption);
return $dropDownMenu;
}
......
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