mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 01:37:17 +00:00
BrowseImportantPaste: Fixed a bug where onClickListener was not set when the table was only 1 page long
This commit is contained in:
parent
409eb25a64
commit
bd46c83fb6
1 changed files with 49 additions and 40 deletions
|
@ -120,6 +120,10 @@ $("#myTable_"+moduleName).attr('data-numElem', "{{ all_path|length }}");
|
|||
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
$("[data-toggle='modal']").off('click.openmodal').on("click.openmodal", function (event) {
|
||||
//get_html_and_update_modal(event);
|
||||
get_html_and_update_modal(event, $(this));
|
||||
});
|
||||
|
||||
search_table = $('#myTable_'+moduleName).DataTable({ "order": [[ 2, "desc" ]] });
|
||||
|
||||
|
@ -182,19 +186,12 @@ $(document).ready(function(){
|
|||
$("#load-more-button").hide();
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
|
||||
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']").off('click.openmodal').on("click.openmodal", function (event) {
|
||||
function get_html_and_update_modal(event, truemodal) {
|
||||
event.preventDefault();
|
||||
var modal=$(this);
|
||||
var url = " {{ url_for('showsavedpastes.showpreviewpaste') }}?paste=" + $(this).attr('data-path') + "&num=" + $(this).attr('data-num');
|
||||
last_clicked_paste = $(this).attr('data-num');
|
||||
|
||||
var modal=truemodal;
|
||||
var url = " {{ url_for('showsavedpastes.showpreviewpaste') }}?paste=" + modal.attr('data-path') + "&num=" + modal.attr('data-num');
|
||||
last_clicked_paste = modal.attr('data-num');
|
||||
$.get(url, function (data) {
|
||||
|
||||
// verify that the reveived data is really the current clicked paste. Otherwise, ignore it.
|
||||
|
@ -231,6 +228,18 @@ $(document).ready(function(){
|
|||
$("#mymodalbody").html("Ignoring previous not finished query of paste #" + received_num);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 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)
|
||||
|
||||
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']").off('click.openmodal').on("click.openmodal", function (event) {
|
||||
get_html_and_update_modal(event, $(this));
|
||||
});
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in a new issue