From: Joey Schulze Date: Mon, 21 Sep 2015 09:40:19 +0000 (+0200) Subject: Automatically remove column select filter if unapplyable X-Git-Url: https://git.infodrom.org/?p=infodrom%2Frico3;a=commitdiff_plain;h=74a8f0e68b0c99e6f4b67456c6262a2ff4edcc6e;hp=ba70519ab89175ab7f931ad845d0386c6cb1792c Automatically remove column select filter if unapplyable When the filter value is stored in a cookie the filter is automatically reapplied on page reload. If table values have changed in the meantime so that the original filter value is not available anymore the LiveGrid will display 0 rows and the select filter element will display __ALL__ (since the value it is set to is not available). The problem could be resolved by filtering for a different value and then resetting the filter select element back to __ALL__. However, since the filter already displays __ALL__ most users won't notice that the grid is already filtered. --- diff --git a/minsrc/ricoLiveGrid.js b/minsrc/ricoLiveGrid.js index d55f345..1afb5d6 100644 --- a/minsrc/ricoLiveGrid.js +++ b/minsrc/ricoLiveGrid.js @@ -872,6 +872,18 @@ Rico.LiveGridMethods = { var rowsElement = response.getElementsByTagName('rows')[0]; var col=this.columns[parseInt(colnum,10)]; var rows = this.buffer.dom2jstable(rowsElement); + var found = !col.filterValues || !col.filterValues.length; + if (!found) for (var i=0; i