Closed gdvallance closed 9 years ago
When searching for data element with a type of number, like nhs_number, your search query must match the number exactly. The current version of Columns does not have an option to change this. However, for a type of string, your search query only needs to match any part of the string.
So, quickest way to fix your problem is to convert nhs_number to a string. See below:
for (var i=0; i<data.record.length; i++) {
data.record[i].nhs_number = data.record[i].nhs_number.toString(); //convert number to string
report.push(data.record[i]);
}
Thanks, Michael
Many thanks for your prompt reply and helpful suggestion on how to address the issue. It is greatly appreciated. From my point of view the issue is closed.
Perhaps a small update to the searchableFields
part of the documentation stating something like "While all data is searchable searches on numeric fields must be exact before they will return a result whereas search on text fields will return partial results." would be useful. If nothing else, this will clarify the scope of the search functionality so that you are not bothered in the future by people such as myself who do at least try and RTFM before asking questions. :-)
@gdvallance
I want to begin by saying "Thank you," for a wonderful well documented project.
I am writing because I would like to know whether "... all data is searchable" (default option for searchableField) means that numeric data is searchable too.
I ask because it appears that numeric data is NOT searchable. Is this correct or is it a bug?
To see what I mean I have created a basic page (see below). Everything except the nhs_number is searchable.
@gdvallance