ember.js

Is there any way to create a batch of multiple records with a single POST request in Ember Data?

点点圈 提交于 2020-01-04 13:41:13
问题 var batch = [someRecord, someRecord, someRecord...] batch.invoke('save'); If I have an array of 50 newly created records and then invoke save on that array, then Ember Data will make 50 POST requests. I would rather bulk them into a single request and handle that on the API for performance. Is there any way to do this? Right now it appears I will have to implement this manually with ajax. But if there is a better way, please share. 回答1: There used to be a bulkCommit feature in ember-data on

#ember-power-select, How to set a preselected value in ember-power-select custom-search action

左心房为你撑大大i 提交于 2020-01-04 08:26:51
问题 There must be a value set in "selected" attribute before typing in search parameter".Can anyone help me to sort this out ? #ember-power-select It is working with normal action-handling by setting a value for "destination" in js and assigning "destination" to "selected". Have a look at here for such examples http://www.ember-power-select.com/docs/action-handling. But can't assign a value for custom-serach-action http://www.ember-power-select.com/docs/custom-search-action. My Code: Models:

How to implement a list of multiple elements, where an element can be expanded by click? (Dynamic Outlet Names?)

大憨熊 提交于 2020-01-04 06:49:08
问题 I want to realize the following concept. Can you give me some hints or keywords at which i should have a look at? These are my requirements: I want to render a list of elements. Each element should contain a button. A click on the button should show additional details relating to the clicked element (I do not want to use jquery for a simple hide and show, since this click triggers an additional call to my backend server). My guess is that it could work like this: Implement an ArrayController

EMBER direct route URL access dont load data

蓝咒 提交于 2020-01-04 06:35:59
问题 i've a problem when i access my url direct from browser, it dosnt load my singular post infos. example: /index.html#/posts/10052308 but it works when i access /index.html#/posts and then click in one of my posts, my url changes to /index.html#/posts/10052308 and works, but if i refresh the page directly on this url it dosnt work any more. I'm loading data from a API (JSON). In my JS: App.Router.map(function() { this.resource('posts', function() { this.resource('post', { path: ':id' }); }); })

How to properly setup a store that acts as a single pointer across your web app

孤者浪人 提交于 2020-01-04 06:16:06
问题 I have a home grown store that has a simple identityMap. When I return an array of models from this and bind it to a controllers "model" it reflects what you'd expect the first time you hit a route it reflects this in the template as you'd expect But later if I get this same store instance (it's a singleton) and push an object into the identityMap it doesn't automatically update the previous template The store itself is super basic (no relationships/ just push objects and get by id) function

Grails internationalization with Ember.js and Handlebars.js

匆匆过客 提交于 2020-01-04 05:57:44
问题 I'm developing a web application and I'd need some advice on how to solve the following 'problem' of internationalization. I use Grails 2.2.0 along with Ember.js and Handlebars.js whereas the frontend (which is realised through JavaScript with the before mentioned frameworks) is residing in it's on project with the Sass files for styling Grunt.js for compiling the whole thing. Within this 'frontend project' I create the handlebars templates which I want to deliver via Grails on demand, with

Ember loading template works only on page refresh

非 Y 不嫁゛ 提交于 2020-01-04 05:40:08
问题 I have in my Ember app this routes: Router.map(function() { // landing page (login/register) this.route('home', {path: '/'}); // authenticated pages this.route('webappFrame', {path: '/app'}, function() { this.route('feed', {path: 'feed'}); this.route('photoDetail', {path: 'photo/detail/:id'}); }); }); where both "feed" and "photoDetail" have a model hook that return a promise (records coming from the server); I have a loading.hbs template in the /template folder; After a page refresh on both

How to update the UI immediately when a new record is added? Related to ember-cli-pagination

不打扰是莪最后的温柔 提交于 2020-01-04 05:38:42
问题 In our app, there is a Company page, which lists all the companies in paginated way. We are using Ember 1.13 and ember-cli-pagination addon for pagination. The data is coming from Rails API, so we are using remote paginated API scenario. Everything is working fine for now, 10 records on each page, next and previous buttons etc. Only problem is when we add a new record, the record is saved but it doesn't show up on the UI immediately, we have to refresh the page for that. There are other parts

How to update the UI immediately when a new record is added? Related to ember-cli-pagination

痞子三分冷 提交于 2020-01-04 05:38:17
问题 In our app, there is a Company page, which lists all the companies in paginated way. We are using Ember 1.13 and ember-cli-pagination addon for pagination. The data is coming from Rails API, so we are using remote paginated API scenario. Everything is working fine for now, 10 records on each page, next and previous buttons etc. Only problem is when we add a new record, the record is saved but it doesn't show up on the UI immediately, we have to refresh the page for that. There are other parts

peekRecord() is not working but peekAll() is working

牧云@^-^@ 提交于 2020-01-04 05:29:09
问题 My backend always responds with all available data and it took a considerably amount of time. So I'm reloading store periodically and I plan to use peekAll() and peekRecord(). My code is: model: function() { return Ember.RSVP.hash({ 'clusters': this.store.peekAll('cluster'), 'single': this.store.peekRecord('cluster', 'cluster::My') }); When code is executed, at first I can see that both of these items do not contain content. After few seconds data are loaded to store and I can see content