From 5b7f1b2518d71ffb7e8c24bb87fd640efd93d8fc Mon Sep 17 00:00:00 2001 From: Nazmi Savga Date: Thu, 2 Jul 2015 18:40:47 +0300 Subject: [PATCH 1/3] case insensitive search, renderColumnSelection does not list the column if the column text is empty, general fix for cell rendering, in case the cell has an html inside (like a button or anchor) --- src/internal.js | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/internal.js b/src/internal.js index f2e3cb6..e34d315 100644 --- a/src/internal.js +++ b/src/internal.js @@ -161,7 +161,7 @@ function loadData() function containsPhrase(row) { var column, - searchPattern = new RegExp(that.searchPhrase, (that.options.caseSensitive) ? "g" : "gi"); + searchPattern = new RegExp(that.searchPhrase, (that.options.caseInsensitive) ? "g" : "gi"); for (var i = 0; i < that.columns.length; i++) { @@ -271,7 +271,8 @@ function loadRows() $.each(that.columns, function (i, column) { - row[column.id] = column.converter.from(cells.eq(i).text()); + //row[column.id] = column.converter.from(cells.eq(i).text()); + row[column.id] = column.converter.from(cells.eq(i).html()); }); appendRow.call(that, row); @@ -372,26 +373,27 @@ function renderColumnSelection(actions) $.each(this.columns, function (i, column) { - var item = $(tpl.actionDropDownCheckboxItem.resolve(getParams.call(that, - { name: column.id, label: column.text, checked: column.visible }))) - .on("click" + namespace, selector, function (e) - { - e.stopPropagation(); - - var $this = $(this), - checkbox = $this.find(checkboxSelector); - if (!checkbox.prop("disabled")) - { - column.visible = checkbox.prop("checked"); - var enable = that.columns.where(isVisible).length > 1; - $this.parents(itemsSelector).find(selector + ":has(" + checkboxSelector + ":checked)") - ._bgEnableAria(enable).find(checkboxSelector)._bgEnableField(enable); - - that.element.find("tbody").empty(); // Fixes an column visualization bug - renderTableHeader.call(that); - loadData.call(that); - } - }); + var columnText = $.trim(column.text); + if (columnText !== '') { + var item = $(tpl.actionDropDownCheckboxItem.resolve(getParams.call(that, + { name: column.id, label: column.text, checked: column.visible }))) + .on("click" + namespace, selector, function (e) { + e.stopPropagation(); + + var $this = $(this), + checkbox = $this.find(checkboxSelector); + if (!checkbox.prop("disabled")) { + column.visible = checkbox.prop("checked"); + var enable = that.columns.where(isVisible).length > 1; + $this.parents(itemsSelector).find(selector + ":has(" + checkboxSelector + ":checked)") + ._bgEnableAria(enable).find(checkboxSelector)._bgEnableField(enable); + + that.element.find("tbody").empty(); // Fixes an column visualization bug + renderTableHeader.call(that); + loadData.call(that); + } + }); + } dropDown.find(getCssSelector(css.dropDownMenuItems)).append(item); }); actions.append(dropDown); From e1e77b9f35c25bb2ec2da610771a0eb4c0501ff9 Mon Sep 17 00:00:00 2001 From: Nazmi Savga Date: Thu, 2 Jul 2015 18:50:35 +0300 Subject: [PATCH 2/3] cell rendering, commented code deleted --- src/internal.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/internal.js b/src/internal.js index e34d315..c6b7605 100644 --- a/src/internal.js +++ b/src/internal.js @@ -271,7 +271,6 @@ function loadRows() $.each(that.columns, function (i, column) { - //row[column.id] = column.converter.from(cells.eq(i).text()); row[column.id] = column.converter.from(cells.eq(i).html()); }); From 2dec600d07e14673fac85e8c65846840ca77a58c Mon Sep 17 00:00:00 2001 From: Nazmi Savga Date: Thu, 2 Jul 2015 18:53:42 +0300 Subject: [PATCH 3/3] fixed my previous mistake for the problem in case item is null. (renderColumnSelection() function) --- src/internal.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal.js b/src/internal.js index c6b7605..fd3c3ca 100644 --- a/src/internal.js +++ b/src/internal.js @@ -392,8 +392,9 @@ function renderColumnSelection(actions) loadData.call(that); } }); + dropDown.find(getCssSelector(css.dropDownMenuItems)).append(item); } - dropDown.find(getCssSelector(css.dropDownMenuItems)).append(item); + }); actions.append(dropDown); }