Partially solved the browser freezing problem + tootlip is also binded at a new page generation of the DataTable

This commit is contained in:
Mokaddem 2016-11-10 09:28:55 +01:00
parent acdd1367a3
commit 34221b083f
2 changed files with 5 additions and 2 deletions

View file

@ -97,7 +97,7 @@ def event_stream_getImportantPasteByModule(module_name):
data["date"] = curr_date
data["char_to_display"] = max_preview_modal
data["finished"] = True if index == len(all_pastes_list) else False
print index
time.sleep(0.002) #So that the front end client is not flooded by data
yield 'data: %s\n\n' % json.dumps(data)

View file

@ -36,6 +36,7 @@ function deploy_source() {
var curr_numElem = parseInt($("#myTable_"+moduleName).attr('data-numElem'));
console.log(curr_numElem);
if (feed.index > curr_numElem & feed.module == moduleName) { // Avoid doubling the pastes
// Add the row to the table
search_table.row.add( [
feed.index,
"<a target=\"_blank\" href=\"{{ url_for('showsavedpaste') }}?paste="+feed.path+"&num="+feed.index+"\"> "+ feed.path +"</a>",
@ -151,7 +152,9 @@ $(document).ready(function(){
// Use to bind the button with the new displayed data
// (The bind do not happens if the dataTable is in tabs and the clicked data is in another page)
$('#myTable').on( 'draw.dt', function () {
search_table.on( 'draw.dt', function () {
// Bind tooltip each time we draw a new page
$('[data-toggle="tooltip"]').tooltip();
// On click, get html content from url and update the corresponding modal
$("[data-toggle='modal']").unbind('click.openmodal').on("click.openmodal", function (event) {
event.preventDefault();