Comments (3)
So far I tried creating a component executes an AJAX call to my endpoint, which returns a response and feeds it into source
at $('.ui.search').search
. The result box doesn't show any results...
The component object:
import Ember from 'ember';
export default Ember.Component.extend({
keywordChanged: function() {
this.set('isSearching', true);
Ember.run.debounce(this, this.productSearch, 2000);
}.observes('keyword'),
productSearch: function() {
var _this = this;
Ember.$.ajax({
url: '/api/v1/searches/products',
type: 'GET',
data: {
name: this.get('keyword')
},
success: function(response) {
// response.searches returns:
// [
// {
// name: 'Steel hat',
// description: 'Lorem ipsum',
// },
// {
// name: 'Green flower',
// description: 'Lorem ipsum dolor',
// }
// ];
_this.$('.ui.search').search({
source: response.searches,
searchFields: ['name'],
searchFullText: false
});
_this.set('isSearching', false);
},
error: function(reason) {
console.log(reason);
}
});
}
});
The component template:
<div {{bind-attr class='isSearching:loading :ui :fluid :search'}}>
<div class="ui icon input">
{{input type='text' value=keyword placeholder='Search' class='prompt'}}
<i class="search icon"></i>
</div>
<div class="results"></div>
</div>
from semantic-ui-ember.
I've looked at doing a search component, but haven't thought of a good way yet to customize it for each persons individual needs. Since the results are so customized based on the search. We might implement a base mixin you can use for search and then you override the specific calls you need to make yours work, but haven't gotten that far yet.
from semantic-ui-ember.
As a follow up to this, looking at the example above, you should be able to do this all through ember and then just reinitialize the search component if changed. In your example above, you could change it to the following
<div {{bind-attr class='isSearching:loading :ui :fluid :search'}}>
<div class="ui icon input">
{{input type='text' value=keyword placeholder='Search' class='prompt'}}
<i class="search icon"></i>
</div>
<div class="results">
{{#each results as |result|}}
<a class="result">{{result}}</a>
{{/each}}
</div>
</div>
Then after your ajax is completed, you could render the results and call $().search() on the main html again. We'll look at providing a better way to handle this through the component, but going to close this specific issue out for now.
from semantic-ui-ember.
Related Issues (20)
- Wrong documenation
- Semantic UI themeing doesn't work HOT 4
- Yarn support? (support silent npm install of Semantic-UI?) HOT 2
- Yarn workspaces compatibility
- Dropdowns are inaccessible for screen readers HOT 3
- Accordion - no such method 'internal' for accordion widget instance
- How to setup theming correctly HOT 1
- Guidelines and TODO HOT 4
- Make a release with addon configuration bugfix to enable themeing HOT 2
- Add support for features released in semantic UI 2.4 HOT 2
- Ember 3.9 DEPRECATION: Using this.$() in a component has been deprecated, consider using this.element [deprecation id: ember-views.curly-components.jquery-element] HOT 9
- Support for fomantic-ui
- Publish a new release HOT 8
- Abandoned Framework/Add-On ? HOT 8
- bug: broken image in README
- Unable to find jQuery Semantic UI module: modal HOT 2
- Unknown feature "default-async-observers" found in config/optional-features.json HOT 13
- Unable to find jQuery Semantic UI module: dropdown
- [question] Support for Ember Octane?
- Any plan to support Fomantic versions and Ember 4-5?
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 semantic-ui-ember.