<commit_before>function applyChanges(data, url, showResult, refreshPage) {
	var success = false;
	$.ajax({
		type : "POST",
		url : url,
		data : JSON.stringify(data),// now data come in this function
		contentType : "application/json; charset=utf-8",
		crossDomain : true,
		dataType : "json",
		success : function(data, status, jqXHR) {
			console.log("Applied changes successfully.")
			if (showResult) {
				var modal = $("#modal_success");
				modal.find('.modal-body p').text("Applied changes successfully");
				modal.modal('show');
			}
			if (refreshPage) {
				location.reload(true);
			}
		},

		error : function(jqXHR, status) {
			console.log(jqXHR);
			var modal = $("#modal_error");
			modal.find('.modal-body p').text(jqXHR["responseText"]);
			modal.modal('show');
		}
	});

}

function getTableData(table) {
	var rData = []

	// reformat - pretty format
	var records = []
	table.rows().every(function() {
		var r = this.data();
		var record = {}
		record["record_name"] = r[0].trim();
		record["record_type"] = r[1].trim();
		record["record_status"] = r[2].trim();
		record["record_ttl"] = r[3].trim();
		record["record_data"] = r[4].trim();
		records.push(record);
	});
	return records
}

function saveRow(oTable, nRow) {
	
	var jqInputs = $(oTable.row(nRow).node()).find("input");
	var jqSelect = $(oTable.row(nRow).node()).find("select");

	if (jqSelect[1].value == 'false') {
		status = 'Active';
	} else {
		status = 'Disabled';
	}


	oTable.cell(nRow,0).data(jqInputs[0].value);
	oTable.cell(nRow,1).data(jqSelect[0].value);
	oTable.cell(nRow,2).data(status);
	oTable.cell(nRow,3).data(jqSelect[2].value);
	oTable.cell(nRow,4).data(jqInputs[1].value);

	var record = jqInputs[0].value;
	var button_edit = "<button type=\"button\" class=\"btn btn-flat btn-warning button_edit\" id=\"" + record +  "\">Edit&nbsp;<i class=\"fa fa-edit\"></i></button>"
	var button_delete = "<button type=\"button\" class=\"btn btn-flat btn-danger button_edit\" id=\"" + record +  "\">Delete&nbsp;<i class=\"fa fa-trash\"></i></button>"

	oTable.cell(nRow,5).data(button_edit);
	oTable.cell(nRow,6).data(button_delete);
	
	oTable.draw();
}

function restoreRow(oTable, nRow) {
    var aData = oTable.row(nRow).data();
    var jqTds = $('>td', nRow);
	oTable.row(nRow).data(aData);
	oTable.draw();
}
<commit_msg>Fix delete button in records table. #91<commit_after>function applyChanges(data, url, showResult, refreshPage) {
	var success = false;
	$.ajax({
		type : "POST",
		url : url,
		data : JSON.stringify(data),// now data come in this function
		contentType : "application/json; charset=utf-8",
		crossDomain : true,
		dataType : "json",
		success : function(data, status, jqXHR) {
			console.log("Applied changes successfully.")
			if (showResult) {
				var modal = $("#modal_success");
				modal.find('.modal-body p').text("Applied changes successfully");
				modal.modal('show');
			}
			if (refreshPage) {
				location.reload(true);
			}
		},

		error : function(jqXHR, status) {
			console.log(jqXHR);
			var modal = $("#modal_error");
			modal.find('.modal-body p').text(jqXHR["responseText"]);
			modal.modal('show');
		}
	});

}

function getTableData(table) {
	var rData = []

	// reformat - pretty format
	var records = []
	table.rows().every(function() {
		var r = this.data();
		var record = {}
		record["record_name"] = r[0].trim();
		record["record_type"] = r[1].trim();
		record["record_status"] = r[2].trim();
		record["record_ttl"] = r[3].trim();
		record["record_data"] = r[4].trim();
		records.push(record);
	});
	return records
}

function saveRow(oTable, nRow) {
	
	var jqInputs = $(oTable.row(nRow).node()).find("input");
	var jqSelect = $(oTable.row(nRow).node()).find("select");

	if (jqSelect[1].value == 'false') {
		status = 'Active';
	} else {
		status = 'Disabled';
	}


	oTable.cell(nRow,0).data(jqInputs[0].value);
	oTable.cell(nRow,1).data(jqSelect[0].value);
	oTable.cell(nRow,2).data(status);
	oTable.cell(nRow,3).data(jqSelect[2].value);
	oTable.cell(nRow,4).data(jqInputs[1].value);

	var record = jqInputs[0].value;
	var button_edit = "<button type=\"button\" class=\"btn btn-flat btn-warning button_edit\" id=\"" + record +  "\">Edit&nbsp;<i class=\"fa fa-edit\"></i></button>"
	var button_delete = "<button type=\"button\" class=\"btn btn-flat btn-danger button_delete\" id=\"" + record +  "\">Delete&nbsp;<i class=\"fa fa-trash\"></i></button>"

	oTable.cell(nRow,5).data(button_edit);
	oTable.cell(nRow,6).data(button_delete);
	
	oTable.draw();
}

function restoreRow(oTable, nRow) {
    var aData = oTable.row(nRow).data();
    var jqTds = $('>td', nRow);
	oTable.row(nRow).data(aData);
	oTable.draw();
}

{'fraction_non_alphanumeric': 0.20704467353951891, 'fraction_numerical': 0.00859106529209622, 'mean_word_length': 4.256207674943567, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2860726', 'n_tokens_mistral': 1836, 'n_tokens_neox': 1690, 'n_words': 310}