Comments (1)
This is outside the scope of the autocomplete plugin. You'll have to code your on solution to handle this use case although the library already gives you all you need and it should be simple enough.
For example, you can listen to autocomplete.change
events from the first autocomplete and when they happen update the data-autocomplete-value
attribute in the second. The autocomplete.change
event has a details
property with the selected value.
// linked_contoller.js
export default class extends Controller {
static targets = [ "second" ]
updateSecondAutocomplete = (event) => {
const newUrl = `/parts?product_id=${event.details.value}`
this.secondTarget.dataset['autocomplete-url'] = newUrl
}
}
<div data-controller="linked">
<div data-controller="autocomplete" data-action="autcomplete.change->linked#updateSecondAutocomplete">
<!-- First autocomplete -->
</div>
<div data-controller="autocomplete" data-linked-target="second">
<!-- Second autocomplete -->
</div>
</div>
from stimulus-autocomplete.
Related Issues (20)
- Feature request : delay option HOT 3
- Use keyboard navigation to navigate results HOT 4
- Provide default styles
- Failed to resolve module specifier "stimulus-autocomplete" HOT 3
- Prefilled form HOT 1
- Additional event on select HOT 3
- How to fetch data on focus? HOT 11
- Make the query paramater name `q` customizable HOT 2
- error event doesn't fire on 400+ response HOT 1
- Auto-select/highlight the first result on "data load ended" HOT 2
- Suggestion: Allow to use local HTML instead of fetching from the server HOT 3
- Prevent Lighthouse Aria warnings HOT 1
- Data is not being Filtered. HOT 1
- Accessibility
- Feature improve: When mouse move on an option item, it should become the current selected option item. HOT 4
- data-autocomplete-query-param-value not working HOT 4
- Error Unexpected token after import stimulus-autocomplete HOT 6
- Setting X-Requested-With header in V3 HOT 2
- onInputFocus is not defined HOT 1
- How can you pass along additional params beyond params[:q] to controller? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stimulus-autocomplete.