-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(fix) O3-3589: Enable data table to search based on all table columns #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @arodidev , there seems to be a preference to using debounce
while doing searches. Is it something you would consider?
I'll work on adding the same, thanks @CynthiaKamau |
}; | ||
}); | ||
|
||
if (searchString && searchString.trim() !== "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You want to do this soft check before the mapping above so that we return early incases of an empty search term.
orderer: string; | ||
} | ||
|
||
function useSearchResults(tableEntries: Order[], searchString): CustomOrder[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function useSearchResults(tableEntries: Order[], searchString): CustomOrder[] { | |
function useOrdersSearchResults(orders: Order[], searchTerm): CustomOrder[] { |
Can you define this hook in a separate file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, forgot to relocate this
const flattenedData = tableEntries.map((eachObject) => { | ||
return { | ||
...eachObject, | ||
dateActivated: formatDate(parseDate(eachObject.dateActivated)), | ||
patient: eachObject.patient?.display.split("-")[1], | ||
patientUuid: eachObject.patient?.uuid, | ||
status: eachObject.fulfillerStatus ?? "--", | ||
orderer: eachObject.orderer?.display.split("-")[1], | ||
}; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be doing this mapping on every search event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll memoize this and pass it as an argument.
Requirements
Summary
This PR fixes an issue with the data table search bar whereby the search was being made based on specific column. This fix introduces a more inclusive search that targets all the columns in the table.
Screenshots
Screen.Recording.2024-07-16.at.07.17.29.mov
Related Issue
https://openmrs.atlassian.net/browse/O3-3589
Other