Skip to content
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

library: Add Search entry #343

Merged
merged 3 commits into from
Jun 28, 2023
Merged

library: Add Search entry #343

merged 3 commits into from
Jun 28, 2023

Conversation

AkshayWarrier
Copy link
Contributor

Closes #338
I'd like to know if I implemented the filtering functionality properly or do I need to change something. And also how do I know if I got no matching results from the search so that I can show a status page for it?

@AkshayWarrier AkshayWarrier changed the title Akshaywarrier/searchbar library: Add Search Bar entry Jun 17, 2023
@sonnyp sonnyp self-assigned this Jun 18, 2023
Copy link
Contributor

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool

And also how do I know if I got no matching results from the search so that I can show a status page for it?

Good question. I guess you store a count that is updated on invalidation and filter

example

let results_count = -1;

fuinction filter(row) {
  const match = res.test...
  if (match) results_count++
  return match
}

searchentry.connect("search-changed", () => {
  // using -1 and not 0 so you can differentiate between
  // no results and not filtered yet
  result_counts = -1;
  listbox.invalidate_filter();
});

src/Library/demos/Search Bar/main.blp Outdated Show resolved Hide resolved
src/Library/demos/Search Bar/main.blp Outdated Show resolved Hide resolved
src/Library/demos/Search Bar/main.js Outdated Show resolved Hide resolved
src/Library/demos/Search Bar/main.js Outdated Show resolved Hide resolved
@AkshayWarrier AkshayWarrier changed the title library: Add Search Bar entry library: Add Search entry Jun 23, 2023
@AkshayWarrier AkshayWarrier marked this pull request as ready for review June 23, 2023 15:02
@sonnyp sonnyp self-requested a review June 25, 2023 17:15
Copy link
Contributor

@sonnyp sonnyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job

@sonnyp sonnyp merged commit b39332b into main Jun 28, 2023
@sonnyp sonnyp deleted the akshaywarrier/searchbar branch June 28, 2023 15:59
sonnyp pushed a commit that referenced this pull request Jun 29, 2023
sonnyp pushed a commit to SoNiC-HeRE/Workbench that referenced this pull request Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add SearchBar demo
2 participants