0

Our team has built an HTML table with a search input at the top:

<input placeholder="Search..." ng-model="searchTable">

In our ng-repeat, we have the following:

<tr ng-repeat="item in data.list | filter:searchTable track by item.sys_id">

This works for the most part, but after extensive testing, we noticed some strange results. Below is what the table returned after we searched for "88":

enter image description here

The above SSNs are all fake, but you can see a number of entries that came back that did not have "88" in any of the columns. In fact all of them don't even have a single 8. Are we anything incorrect here? Any suggestions on how to fix this bug? Thanks!

Dave
  • 1,257
  • 2
  • 27
  • 58
  • Is there any data not shown in your table that would match what is being filtered? – tbone849 May 19 '20 at 10:23
  • no there aren't – Dave May 19 '20 at 12:54
  • Can you log one the objects for us to see? – tbone849 May 19 '20 at 19:29
  • hey @tbone849, I think i know what's going on, but unsure how to fix it. The Employee Name column is a reference field to a User table. Each User entry has a unique id and for each of the outliers outlined in red above, all of their unique id's (sys_id's) contain "88". Not sure why the search would be able to search beyond the column display values and unsure of how to prevent it from doing so. Any suggestions? – Dave May 19 '20 at 22:34
  • The filter doesn’t care what is displayed on the table. It will filter all the data that exists on the object. – tbone849 May 20 '20 at 02:07
  • A custom filter could fix this issue though – tbone849 May 20 '20 at 04:45
  • Try this https://stackoverflow.com/a/13821640/5781575 – tbone849 May 20 '20 at 04:48

0 Answers0