mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-23 16:52:26 +02:00
Fixed popup filter bug related to RemoveGrid action
This commit is contained in:
parent
745d815ae8
commit
261f2ea870
1
TODO
1
TODO
|
@ -3,3 +3,4 @@
|
|||
- Use DOM event listeners for DOM events
|
||||
- Refactor persistence using localStorage or cookie
|
||||
- Verify linked filters work as per production
|
||||
- Re-style pop-up filter with advanced CSS3 effects
|
2
dist/filtergrid.css
vendored
2
dist/filtergrid.css
vendored
|
@ -1,6 +1,6 @@
|
|||
/*------------------------------------------------------------------------
|
||||
- TableFilter stylesheet by Max Guglielmi
|
||||
- (build date: Sun Feb 15 2015 19:52:24)
|
||||
- (build date: Tue Feb 17 2015 17:46:15)
|
||||
- Edit below for your projects' needs
|
||||
------------------------------------------------------------------------*/
|
||||
|
||||
|
|
|
@ -57,9 +57,7 @@ export class PopupFilter{
|
|||
elm = evt.target.parentNode,
|
||||
colIndex = parseInt(elm.getAttribute('ci'), 10);
|
||||
|
||||
// o.CloseAllPopupFilters(colIndex);
|
||||
this.closeAll(colIndex);
|
||||
// o.TogglePopupFilter(colIndex);
|
||||
this.toggle(colIndex);
|
||||
|
||||
if(this.popUpFltAdjustToContainer){
|
||||
|
@ -93,20 +91,26 @@ export class PopupFilter{
|
|||
popUpSpan.innerHTML = this.popUpImgFltHtml;
|
||||
var header = tf.GetHeaderElement(i);
|
||||
header.appendChild(popUpSpan);
|
||||
// popUpSpan.onclick = onClick;
|
||||
Event.add(popUpSpan, 'click', (evt) => { this.onClick(evt); });
|
||||
this.popUpFltSpans[i] = popUpSpan;
|
||||
this.popUpFltImgs[i] = popUpSpan.firstChild;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build all pop-up filters elements
|
||||
*/
|
||||
buildAll(){
|
||||
for(var i=0; i<this.popUpFltElmCache.length; i++){
|
||||
this.build(i, this.popUpFltElmCache[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a specified pop-up filter elements
|
||||
* @param {Number} colIndex Column index
|
||||
* @param {Object} div Optional container DOM element
|
||||
*/
|
||||
build(colIndex, div){
|
||||
var tf = this.tf;
|
||||
var popUpDiv = !div ?
|
||||
|
@ -121,9 +125,14 @@ export class PopupFilter{
|
|||
this.popUpFltElms[colIndex] = popUpDiv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toogle visibility of specified filter
|
||||
* @param {Number} colIndex Column index
|
||||
*/
|
||||
toggle(colIndex){
|
||||
var tf = this.tf,
|
||||
popUpFltElm = this.popUpFltElms[colIndex];
|
||||
|
||||
if(popUpFltElm.style.display === 'none' ||
|
||||
popUpFltElm.style.display === ''){
|
||||
if(this.onBeforePopUpOpen){
|
||||
|
@ -151,6 +160,10 @@ export class PopupFilter{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Close all filters excepted for the specified one if any
|
||||
* @param {Number} exceptIdx Column index of the filter to not close
|
||||
*/
|
||||
closeAll(exceptIdx){
|
||||
for(var i=0; i<this.popUpFltElms.length; i++){
|
||||
if(i === exceptIdx){
|
||||
|
@ -163,12 +176,20 @@ export class PopupFilter{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build all the icons representing the pop-up filters
|
||||
*/
|
||||
buildIcons(){
|
||||
for(var i=0; i<this.popUpFltImgs.length; i++){
|
||||
this.buildIcon(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build specified icon
|
||||
* @param {Number} colIndex Column index
|
||||
* @param {Boolean} active Apply active state
|
||||
*/
|
||||
buildIcon(colIndex, active){
|
||||
var activeImg = Types.isUndef(active) ? true : active;
|
||||
if(this.popUpFltImgs[colIndex]){
|
||||
|
@ -177,6 +198,9 @@ export class PopupFilter{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove pop-up filters
|
||||
*/
|
||||
destroy(){
|
||||
this.popUpFltElmCache = [];
|
||||
for(var i=0; i<this.popUpFltElms.length; i++){
|
||||
|
|
|
@ -907,9 +907,9 @@ TableFilter.prototype = {
|
|||
}
|
||||
|
||||
if(this.popUpFilters){
|
||||
if(!this.isFirstLoad && !this.gridLayout){
|
||||
this.headersRow--;
|
||||
}
|
||||
// if(!this.isFirstLoad && !this.gridLayout){
|
||||
// this.headersRow--;
|
||||
// }
|
||||
// this.SetPopupFilterIcons();
|
||||
if(!this.Cpt.popupFilter){
|
||||
var PopupFilter = require('modules/popupFilter').PopupFilter;
|
||||
|
@ -3976,7 +3976,7 @@ TableFilter.prototype = {
|
|||
- returns a header DOM element for a given column
|
||||
index
|
||||
=====================================================*/
|
||||
GetHeaderElement: function(colIndex){
|
||||
GetHeaderElement: function(colIndex){console.log(this.headersRow);
|
||||
var table = this.gridLayout ? this.headTbl : this.tbl;
|
||||
var header, tHead = dom.tag(this.tbl,'thead');
|
||||
for(var i=0; i<this.nbCells; i++){
|
||||
|
|
|
@ -52,9 +52,7 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
|
|||
value: function (e) {
|
||||
var evt = e || global.event, elm = evt.target.parentNode, colIndex = parseInt(elm.getAttribute("ci"), 10);
|
||||
|
||||
// o.CloseAllPopupFilters(colIndex);
|
||||
this.closeAll(colIndex);
|
||||
// o.TogglePopupFilter(colIndex);
|
||||
this.toggle(colIndex);
|
||||
|
||||
if (this.popUpFltAdjustToContainer) {
|
||||
|
@ -82,7 +80,6 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
|
|||
popUpSpan.innerHTML = this.popUpImgFltHtml;
|
||||
var header = tf.GetHeaderElement(i);
|
||||
header.appendChild(popUpSpan);
|
||||
// popUpSpan.onclick = onClick;
|
||||
Event.add(popUpSpan, "click", function (evt) {
|
||||
_this.onClick(evt);
|
||||
});
|
||||
|
@ -119,6 +116,7 @@ define(["exports", "../types", "../dom", "../event", "../helpers"], function (ex
|
|||
writable: true,
|
||||
value: function (colIndex) {
|
||||
var tf = this.tf, popUpFltElm = this.popUpFltElms[colIndex];
|
||||
|
||||
if (popUpFltElm.style.display === "none" || popUpFltElm.style.display === "") {
|
||||
if (this.onBeforePopUpOpen) {
|
||||
this.onBeforePopUpOpen.call(null, this, this.popUpFltElms[colIndex], colIndex);
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue