Hi is there a way in Ember to lazy load stuff into a table? I am loading the first page initially but then as the user scrolls down I want to load ping the second page API call and add that into the table. Is there a way of doing that in Ember? A link to a tutorial will be highly appreciated. I cannot seem to find one
Ember-Table is a pre-built component that does exactly that.
Related
I followed the DJango-tables2 official tutorial and was able to create data set in the terminal using:
Person.objects.bulk_create([Person(name='Jieter'), Person(name='Bradley')])
However, the new data in the table on the website doesn't show up until I hit the refresh button. My question is how the table can be updated/refreshed without any human interaction on the webpage.
What I'm trying to achieve is to update the table on the webpage without human interaction as soon as new data comes in. I'm relatively new to this, any suggestions would be greatly appreciated.
Thank you.
To avoid refreshing the page you would need to get new data using an Ajax request, this table use template rendering meaning it is not meant to work like you want to use it.
Usually, to do what you want to do, you need a front end JavaScript component like Datatables.net, FancyGrid ... and make requests to server using Ajax to get new data.
I have a comments table what is linked to blog post. For each comment in the database table it is listed as it's own row on the template. I would like to lazy load each comment so users browsers don't need to load thousands of comments in their browsers.
Is this what SQLAlchemy's lazy='dynamic' does? The docs confuse me on the subject of lazy and eager loading. I am only use to using lazy load libraries to lazily load images. I am new to Python, Flask and SQLAlchemy.
If per your comment, you're loading the comments via a query with yield_per, the lazy attribute is somewhat irrelevant as it applies to entity relationship mapping (e.g. if you were loading posts which each had their own comments mapped as a relationship attribute).
Unless you're planning to stream the comments over an HTTP connection that you will keep open, I'm not sure yield_per is the best choice.
An easiest solution would be to leverage http://flask-sqlalchemy.pocoo.org/2.1/api/#flask.ext.sqlalchemy.Pagination where you initially load the first page of comments, e.g. 25. Then upon a js scrolling event, kick an ajax call kicking the same query asking for page 2, and so on.
Hope it helps.
I am planning an Ember web app which I want to operate on one page without page reloads.
However, I also want to be able to share the state of the app at any time, and therefore make use of Ember's URL-centric design.
As a total Ember noob, I am wondering if and how Ember accomplishes this (relying on routes, but without page reloads).
Any info is greatly appreciated!
I would recommend reading up on "Query Parameters" (see here) as that is the feature it sounds like you are looking for.
I've done some example apps in Ember, and now I'm ready for using it in existing application. Its traditional web application (request-response, full reload and some ajax loaded content, no rest/api things)
So lets assume I've few page (urls) like
1 abc.com/home.php
2. abc.com/support.php ,
3. abc.com/support.php?call=meeting
and so on..
so is it possible to use just one url with ember app and rest leave as such untill its ready?
PS: I did try for support.php as this.route("support",{path:"/support.php"}) and have SupportController and support.hbs template but its not working. I'm not sure how to put it in jsfiddle.
Thanks
Include your ember app only on the page that needs it, so only on abc.com/support.php
As far as ember can see, when you go to abc.com/support.php you are on the index page (of the ember app), and you will need to use the index.hbs tempate.
I am concerned about page ranking on google with the following situation:
I am looking to convert my existing site with 150k+ unique page results to a ember app, off the route. so currently its something like domain.com/model/id - With ember and hash change - it will be /#/model/id. I really want history state but lack of IE support doesn't leave that as a option. So my Sitemap for google has lots and lots of great results using the old model/id. On the rails side I will test browser for compatibility, before either rendering the JS rich app or the plain HTML / CSS. Does anyone have good SEO suggestions with my current schema for success.
Linked below is my schema and looking at the options -
http://static.allplaces.net/images/EmberTF.pdf
History state is awesome but it looks like support is only around 60% of browsers.
http://caniuse.com/history
Thanks guys for the suggestions, the google guide is similar to what I'm going to try. I will roll it out to 1 client this month, and see what webmasters and analytics show.
here is everything you need to have your hash links be seo friendly: https://developers.google.com/webmasters/ajax-crawling/
basically You write Your whole app with hashlinks, but You have to add "!" to them, so You have #!/model/id. Next You must have all pages somewhere generated and if google asks for them, return "plain html" as described here: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
use google webmaster tools to check if Your site is crawlable.
I'm not sure if you're aware that you can configure Ember to use the browser history for the location API and keep using your pages the way they are reference now. All you need to do is configure the Route's location property
App.Router.reopen({
location: 'history'
});
See more details about specifying the location api here