Skip to content

Commit 39bd181

Browse files
committed
Added new option to exclude columns from search (rstaib#23)
1 parent e2b3766 commit 39bd181

File tree

6 files changed

+8
-3
lines changed

6 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
- (Done) New methods (`select` and `deselect`)
1818
- (Done) New `data-row-id` attribute for data rows (contains the row ID if `identifier` is enabled; otherwise an index of the visible rows)
1919
- (Done) New CSS class for data rows to indicate that the row is selected (`selected`)
20+
- (Done) New column option `data-searchable="true"` to exclude column from search (solved issue [#23](http://github.com/rstaib/jquery-bootgrid/issues/23))
2021

2122
### Bug Fixes
2223
- (Done) Fixed an AJAX issue where multiple fast clicks could lead to strange results
30 Bytes
Binary file not shown.
44 Bytes
Binary file not shown.

build/jquery.bootgrid.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@
115115
headerCssClass: data.headerCssClass || "",
116116
formatter: that.options.formatters[data.formatter] || null,
117117
order: (!sorted && (data.order === "asc" || data.order === "desc")) ? data.order : null,
118+
searchable: !(data.searchable === false), // default: true
118119
sortable: !(data.sortable === false), // default: true
119120
visible: !(data.visible === false) // default: true
120121
};
@@ -172,7 +173,8 @@
172173
for (var i = 0; i < that.columns.length; i++)
173174
{
174175
column = that.columns[i];
175-
if (column.visible && column.converter.to(row[column.id]).search(searchPattern) > -1)
176+
if (column.searchable && column.visible &&
177+
column.converter.to(row[column.id]).search(searchPattern) > -1)
176178
{
177179
return true;
178180
}

build/jquery.bootgrid.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/internal.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ function loadColumns()
105105
headerCssClass: data.headerCssClass || "",
106106
formatter: that.options.formatters[data.formatter] || null,
107107
order: (!sorted && (data.order === "asc" || data.order === "desc")) ? data.order : null,
108+
searchable: !(data.searchable === false), // default: true
108109
sortable: !(data.sortable === false), // default: true
109110
visible: !(data.visible === false) // default: true
110111
};
@@ -162,7 +163,8 @@ function loadData()
162163
for (var i = 0; i < that.columns.length; i++)
163164
{
164165
column = that.columns[i];
165-
if (column.visible && column.converter.to(row[column.id]).search(searchPattern) > -1)
166+
if (column.searchable && column.visible &&
167+
column.converter.to(row[column.id]).search(searchPattern) > -1)
166168
{
167169
return true;
168170
}

0 commit comments

Comments
 (0)