question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add new option for custom match callback

See original GitHub issue

Now, the way to specify which options should be shown is to pass the labelKey prop.

It would be nice if there was an option for passing a callback function that, having received an option, would tell whether it should match the query or not.

Here’s my motivation for requesting this feature: suppose I have a list of objects:

[
  ...,
  { username: 'Bob', email: 'bob@mail.com' },
  ...,
]

and I’d like the matching to occur whenever either username or email matches the query.

Currently, I have to specify another field, say key: username + email, and match agains this field.

But now the same key is being shown for selected items! That’s ugly, I don’t want that, I just want to show the username, but then the matching won’t work properly.

Another way to solve my particular use-case would be to provide an option for custom rendering (or at least allowing to choose the rendered text) for selected items.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ericgiocommented, May 4, 2017

@carlodicelico: I agree that what you’re suggesting is a bit more convenient for some narrow set of use cases. However, given that what you ultimately want — to use your own matching algorithm — is currently possible, I’m not sure it’s worth the effort. A lot of the code in defaultFilterBy is just checking the data format to understand how it should apply the comparison. It doesn’t seem to me like you need that anyway, since I would assume you already know how your data is structured.

1reaction
ericgiocommented, Aug 24, 2016

As of v0.9.0, you can use the filterBy prop to customize how the results are filtered.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Advanced Callbacks | Dash for Python Documentation | Plotly
"id_str": for pattern matching IDs, it's the stringified dict ID with no white spaces. "property": the component property used in the callback. "value":...
Read more >
Callbacks in App Designer - MATLAB & Simulink - MathWorks
Right-click a component in the canvas, Component Browser, or App Layout pane, and select Callbacks > Add (callback property) callback. Context menu associated ......
Read more >
Callback — PyTorch Lightning 1.8.6 documentation
A callback is a self-contained program that can be reused across projects. Lightning has a callback system to execute them when needed.
Read more >
Select2 3.5.3
Select2 supports ability to add choices automatically as the user is typing into the ... The dropdown below matches on custom attributes of...
Read more >
Bolt for JavaScript - Slack Platform Developer Tools
This will match any message that contains app.message(':wave:', ... own custom Redirect URI, you can set redirectUri in the App options ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found