From 7cf02c35669abb8a14e116d8afd1d4f1986337f3 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 24 Oct 2019 14:03:08 +0200 Subject: [PATCH] Added INITIAL FILTER to LA bestellen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Initial filter is: no dummies, neu or geändert. Now these rows are presented to the user when loading the page. --- .../views/lehre/lehrauftrag/orderLehrauftrag.php | 16 ++++++++++++++++ .../lehre/lehrauftrag/orderLehrauftragData.php | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/application/views/lehre/lehrauftrag/orderLehrauftrag.php b/application/views/lehre/lehrauftrag/orderLehrauftrag.php index c386caeee..87315da43 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftrag.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftrag.php @@ -178,6 +178,22 @@ $this->load->view( // Custom filters // ----------------------------------------------------------------------------------------------------------------- + /* + * Filters neue AND geaenderte initially + * NOTE: This is a workaround. The tabulators callback initialFilter is not used here because + * it is processed before the callback tableBuilt, where the status is going to be built. + * The callback dataLoaded is processed after tableBuild and provides the status. + */ + function func_dataLoaded(data, table){ + table.setFilter([ + {field: 'personalnummer', type: '>=', value: 0}, // not dummy lector AND + [ + {field: 'status', type: '=', value: 'Neu'}, // neu OR + {field: 'status', type: '=', value: 'Geändert'} // geaendert + ] + ]); + } + // Filters geaenderte function filter_showChanged(data){ diff --git a/application/views/lehre/lehrauftrag/orderLehrauftragData.php b/application/views/lehre/lehrauftrag/orderLehrauftragData.php index 1c620ccf5..320cbeddc 100644 --- a/application/views/lehre/lehrauftrag/orderLehrauftragData.php +++ b/application/views/lehre/lehrauftrag/orderLehrauftragData.php @@ -369,7 +369,10 @@ $filterWidgetArray = array( }, tableBuilt: function(){ func_tableBuilt(this); - } + }, + dataLoaded: function(data){ + func_dataLoaded(data, this); + }, }', // tabulator properties 'datasetRepFieldsDefs' => '{ // column status is built dynamically in funcTableBuilt()