Knockout-Contrib / Knockout-Contrib/KoGrid

Allow for searching on specified fields instead of entire object

Open
#237 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
277
Forks
124
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a datagrid bound to a complex business object, and only a few properties are shown in the grid.
One of the use-cases is the table-wide search on words and parts of words.

The 'problem' is that koGrid seems to check ALL properties in the associated model, instead of just the ones that are shown. This leads to unexpected results, because some rows don't 'visually' contain the search words specified.

Wouldn't it be a good addition if we could specify which properties that have to be included in the search, instead of scanning the entire object for properties?

```
if (!condition.column) {
for (var prop in item) {
if (item.hasOwnProperty(prop)) {
var pVal = ko.utils.unwrapObservable(item[prop]);
if (pVal && condition.regex.test(pVal.toString())) {
return true;
}
}
}
return false;
}
```

Kr
Sander

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the table-wide search branch shown in the issue and inspect how the grid's visible columns are configured. Determine how callers can select searchable properties, then verify that searches match only those properties instead of hidden fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.