Loading data in background


#1

I’m using Ember App Kit, but just using ajax for loading data. I’m not using Ember Data at the moment.

Here is a typical file that loads data for me:

import ajax from 'ic-ajax';

export default Ember.Object.extend({
find: function() {
	return ajax(window.ENV.api_url + 'developers');
},
findOne: function(id) {
	return ajax(window.ENV.api_url + 'developers/'+id);
},
});

The problem is that the developers api endpoint only returns 10 records at a time so I guess I need to create an Ember Array and push the objects in the array with a loop around the ajax call so I can specify the page number I need.

return ajax(window.ENV.api_url + 'developers?page='+page');

What I want to do is return the first 10 records to my model and have the page show up immediately with those 10 records but in the background go ahead and load up the rest of the items and add them to the page when they complete.

How can I accomplish something like this?


#2

Hi Mike , I have few questions about ember.js regarding to my application, can you please help me ?

      I am working on a application in ember.js . I have an few questions to all of you guys. First lets discuss about my application points and then what problem I am facing in.
  1. Application is about something like a drawing a plans like a "auto cad ". For this purpose I am using d3.js library

  2. For a drawing purpose we have different sections like Fire, Water, etc…Satelite All of this sections have different svg container for drawing.

  3. After this things I have one module for email this sections to a particular email id in three ways

    3.1 Current Section wise email (Means if we drawing in a fire section then If we send email then svg of fire section will send as a form of pdf) (Done)
    
    3.2 At a time all the sections svg content in PDF. (Here my actual problem starts)
    

In this point all sections email I am getting problem in retrieve all section svg’s at a time. Because the current section is already loaded in a view, template with data , But how can I get all the sections template with its drawing data (svg element’s).