Header table now triggers modified status
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
//TODO: Add delete buttons for messages
|
||||
// TODO: Add function to add row
|
||||
// TODO: Add remove closest tr function to header rows
|
||||
var clientUUID = '';
|
||||
var advancedDisplayed = false;
|
||||
var json = {};
|
||||
@@ -226,10 +223,15 @@ function createLink(uuid, id){
|
||||
|
||||
function fillHeaderTable(headers){
|
||||
var innerHTML = buildHeaderMapHtml(headers);
|
||||
$('#headerMapTable').html(innerHTML);
|
||||
$('.tableField').change(function(){setDataModified()});
|
||||
refreshHeaderTable(innerHTML);
|
||||
}
|
||||
|
||||
function refreshHeaderTable(html){
|
||||
$('#headerMapTable').html(html);
|
||||
$('.table-map').change(function(){setDataModified()});
|
||||
$('.btn-hashmap').click(function(){
|
||||
$(this).closest('tr').remove();
|
||||
setDataModified();
|
||||
})
|
||||
}
|
||||
|
||||
@@ -241,14 +243,11 @@ function buildHeaderMapHtml(headers){
|
||||
return innerHTML;
|
||||
}
|
||||
|
||||
// TODO: Add this click remove closest tr
|
||||
|
||||
|
||||
function addRow(key, value){
|
||||
var headerMap = $('#headerMapTable');
|
||||
var headersMapHtml = headerMap.html();
|
||||
headersMapHtml += buildRowHtml(key, value);
|
||||
headerMap.html(headersMapHtml);
|
||||
refreshHeaderTable(headersMapHtml);
|
||||
}
|
||||
|
||||
const newRowInput = function(){
|
||||
@@ -258,6 +257,7 @@ const newRowInput = function(){
|
||||
addRow(hName.val(), hValue.val());
|
||||
hName.val(null);
|
||||
hValue.val(null);
|
||||
setDataModified();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,8 +270,8 @@ function checkIfInputValid(input){
|
||||
function buildRowHtml(key, value){
|
||||
return '' +
|
||||
'<tr>' +
|
||||
'<td><input class="key" value="' + key + '"></td>' +
|
||||
'<td><input value="' + value + '"></td>' +
|
||||
'<td><input class="key data-field" value="' + key + '"></td>' +
|
||||
'<td><input class="data-field" value="' + value + '"></td>' +
|
||||
'<td><button class="modification-button btn-hashmap"><i class="icon-cancel"></i></button></td>' +
|
||||
'</tr>';
|
||||
}
|
||||
@@ -299,8 +299,6 @@ function fillMessageList(){
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//TODO: Implement methods where its possible
|
||||
function findJsonById(id){
|
||||
return json[findJsonIndexById(id)];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user