From 2a6d520b16e6a170bf0165bcac5d31ecab7f11be Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Fri, 16 May 2014 11:13:23 +0200 Subject: [PATCH] Pending changes: number of pendings calculated in the queryupdater plugin, not anymore in datatables in order to take into account the leases published by the scheduler, or any other plugin --- plugins/querytable/static/js/querytable.js | 5 ----- plugins/queryupdater/static/js/queryupdater.js | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js index 5e734a1e..97fa4b45 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querytable/static/js/querytable.js @@ -402,15 +402,10 @@ switch(data.request) { case FIELD_REQUEST_ADD: case FIELD_REQUEST_ADD_RESET: - // update pending number - $("#badge-pending").data('number', $("#badge-pending").data('number') + 1 ); - $("#badge-pending").text($("#badge-pending").data('number')); this.set_checkbox_from_data(data.value, true); break; case FIELD_REQUEST_REMOVE: case FIELD_REQUEST_REMOVE_RESET: - $("#badge-pending").data('number', $("#badge-pending").data('number') - 1 ); - $("#badge-pending").text($("#badge-pending").data('number')); this.set_checkbox_from_data(data.value, false); break; default: diff --git a/plugins/queryupdater/static/js/queryupdater.js b/plugins/queryupdater/static/js/queryupdater.js index e4b3f9ce..5a7f7ba0 100644 --- a/plugins/queryupdater/static/js/queryupdater.js +++ b/plugins/queryupdater/static/js/queryupdater.js @@ -142,6 +142,8 @@ row = this.find_row(data.value); if (row) this.table.fnDeleteRow(row.nTr); + $("#badge-pending").data('number', $("#badge-pending").data('number') - 1 ); + $("#badge-pending").text($("#badge-pending").data('number')); return; case FIELD_REQUEST_CHANGE: action = 'UPDATE'; @@ -188,6 +190,8 @@ // XXX second parameter refresh = false can improve performance. todo in querytable also this.table.fnAddData(newline); row = this.find_row(data.value); + $("#badge-pending").data('number', $("#badge-pending").data('number') + 1 ); + $("#badge-pending").text($("#badge-pending").data('number')); } else { // Update row text... this.table.fnUpdate(newline, row.nTr); @@ -305,6 +309,7 @@ on_added_record: function(record) { this.set_record_state(record, RECORD_STATE_ADDED); + // update pending number }, on_removed_record: function(record_key) -- 2.43.0