Give tables unique ids to save state indivdually

This commit is contained in:
JonnyWong16 2016-02-27 13:39:21 -08:00
parent fa8c5e0982
commit 464d2a541d
4 changed files with 32 additions and 32 deletions

View file

@ -348,21 +348,21 @@ DOCUMENTATION :: END
</div>
</div>
<div class="table-card-back">
<table class="display" id="history_table" width="100%">
<table class="display" id="history_table-RK-${data['rating_key']}" width="100%">
<thead>
<tr>
<th align='left' id="delete">Delete</th>
<th align='left' id="time">Time</th>
<th align='left' id="friendly_name">User</th>
<th align='left' id="ip_address">IP Address</th>
<th align='left' id="platform">Platform</th>
<th align='left' id="player">Player</th>
<th align='left' id="title">Title</th>
<th align='left' id="started">Started</th>
<th align='left' id="paused_counter">Paused</th>
<th align='left' id="stopped">Stopped</th>
<th align='left' id="duration">Duration</th>
<th align='left' id="percent_complete"></th>
<th align="left" id="delete">Delete</th>
<th align="left" id="time">Time</th>
<th align="left" id="friendly_name">User</th>
<th align="left" id="ip_address">IP Address</th>
<th align="left" id="platform">Platform</th>
<th align="left" id="player">Player</th>
<th align="left" id="title">Title</th>
<th align="left" id="started">Started</th>
<th align="left" id="paused_counter">Paused</th>
<th align="left" id="stopped">Stopped</th>
<th align="left" id="duration">Duration</th>
<th align="left" id="percent_complete"></th>
</tr>
</thead>
<tbody></tbody>
@ -458,11 +458,11 @@ DOCUMENTATION :: END
<script>
$(document).ready(function () {
get_history();
history_table = $('#history_table').DataTable(history_table_options);
history_table = $('#history_table-RK-${data["rating_key"]}').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('div.colvis-button-bar');
clearSearchButton('history_table', history_table);
clearSearchButton('history_table-RK-${data["rating_key"]}', history_table);
$('#row-edit-mode').on('click', function() {
$('#row-edit-mode-alert').fadeIn(200);
@ -521,7 +521,7 @@ DOCUMENTATION :: END
</script>
% if source == 'history':
<script>
$('#row-edit-mode').after('<a href="update_metadata?rating_key=${data['rating_key']}&update=True" class="btn btn-danger btn-edit" id="fix-metadata"> \
$('#row-edit-mode').after('<a href="update_metadata?rating_key=${data["rating_key"]}&update=True" class="btn btn-danger btn-edit" id="fix-metadata"> \
<i class="fa fa-wrench"></i> Fix Metadata</a>');
</script>
% endif

View file

@ -23,7 +23,7 @@ media_info_table_options = {
"emptyTable": "No data in table"
},
"pagingType": "bootstrap",
"stateSave": false,
"stateSave": true,
"processing": false,
"serverSide": true,
"pageLength": 25,

View file

@ -186,7 +186,7 @@ DOCUMENTATION :: END
</div>
</div>
<div class="table-card-back">
<table class="display" id="history_table" width="100%">
<table class="display" id="history_table-SID-${data['section_id']}" width="100%">
<thead>
<tr>
<th align="left" id="delete">Delete</th>
@ -245,7 +245,7 @@ DOCUMENTATION :: END
</div>
</div>
<div class="table-card-back">
<table class="display" id="media_info_table" width="100%">
<table class="display" id="media_info_table-SID-${data['section_id']}" width="100%">
<thead>
<tr>
<th align="left" id="added_at">Added At</th>
@ -380,12 +380,12 @@ DOCUMENTATION :: END
};
}
}
history_table = $('#history_table').DataTable(history_table_options);
history_table = $('#history_table-SID-${data["section_id"]}').DataTable(history_table_options);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('#button-bar-history');
clearSearchButton('history_table', history_table);
clearSearchButton('history_table-SID-${data["section_id"]}', history_table);
}
function loadMediaInfoTable() {
@ -401,12 +401,12 @@ DOCUMENTATION :: END
};
}
}
media_info_table = $('#media_info_table').DataTable(media_info_table_options);
media_info_table = $('#media_info_table-SID-${data["section_id"]}').DataTable(media_info_table_options);
var colvis = new $.fn.dataTable.ColVis(media_info_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' });
$(colvis.button()).appendTo('#button-bar-media-info');
clearSearchButton('media_info_table', media_info_table);
clearSearchButton('media_info_table-SID-${data["section_id"]}', media_info_table);
}
$( "#history-tab-btn" ).one( "click", function() {

View file

@ -148,7 +148,7 @@ from plexpy import helpers
</div>
</div>
<div class="table-card-back">
<table id="user_ip_table" class="display" width="100%">
<table id="user_ip_table-UID-${data['user_id']}" class="display" width="100%">
<thead>
<tr>
<th align="left">Last Seen</th>
@ -186,7 +186,7 @@ from plexpy import helpers
</div>
</div>
<div class="table-card-back">
<table class="display" id="history_table" width="100%">
<table class="display" id="history_table-UID-${data['user_id']}" width="100%">
<thead>
<tr>
<th align="left" id="delete">Delete</th>
@ -226,7 +226,7 @@ from plexpy import helpers
</div>
</div>
<div class="table-card-back">
<table class="display" id="sync_table" width="100%">
<table class="display" id="sync_table-UID-${data['user_id']}" width="100%">
<thead>
<tr>
<th align="left" id="state">State</th>
@ -356,13 +356,13 @@ from plexpy import helpers
};
}
}
history_table = $('#history_table').DataTable(history_table_options);
history_table = $('#history_table-UID-${data["user_id"]}').DataTable(history_table_options);
history_table.column(2).visible(false);
var colvis = new $.fn.dataTable.ColVis(history_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark', exclude: [0, 11] });
$(colvis.button()).appendTo('#button-bar-history');
clearSearchButton('history_table', history_table);
clearSearchButton('history_table-UID-${data["user_id"]}', history_table);
$('#history_table_filter').prepend('<div class="btn-group" data-toggle="buttons" id="media_type-selection" style="padding-right: 15px;"> \
<label class="btn btn-dark active"> \
@ -405,9 +405,9 @@ from plexpy import helpers
};
}
}
user_ip_table = $('#user_ip_table').DataTable(user_ip_table_options);
user_ip_table = $('#user_ip_table-UID-${data["user_id"]}').DataTable(user_ip_table_options);
clearSearchButton('user_ip_table', user_ip_table);
clearSearchButton('user_ip_table-UID-${data["user_id"]}', user_ip_table);
});
$( "#sync-tab-btn" ).one( "click", function() {
@ -418,13 +418,13 @@ from plexpy import helpers
d.user_id = user_id;
}
}
sync_table = $('#sync_table').DataTable(sync_table_options);
sync_table = $('#sync_table-UID-${data["user_id"]}').DataTable(sync_table_options);
sync_table.column(1).visible(false);
var colvis_sync = new $.fn.dataTable.ColVis( sync_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' } );
$( colvis_sync.button() ).appendTo('#button-bar-sync');
clearSearchButton('sync_table', sync_table);
clearSearchButton('sync_table-UID-${data["user_id"]}', sync_table);
});
// Load edit user modal