I'm using tastypie + django + backbone.js . My application should be usable by more than one user at a time.
What I want to do is to show all users "live" changes on the database without having the users manually reloading the page.
Anyone around to point me in the right direction?
Thanks
To get this working in all major browsers you will have to periodically send an AJAX request to your server asking if any changes have occured.
In modern browsers you could make use ob web sockets to setup a PUSH service where the server can push those changes to your application or simply notify you about it.
(If you are using Backbone as an MVC framework anyway you might as well step back from the idea of reloading the page and just request your data using AJAX and use Backbone's View component to render your data into HTML elements)
Related
I'm looking for a NodeJS MVC framework that allows rendering partial views on client side using Ajax (without whole page refreshing).
As far as I know, you can declare partial views on server with almost any Framework (Express, Sails...), but this will lead to refresh the whole page even if there's only a small portion of your page that really changes. This problem doesn't exist with a SPA Framework (this one would just load the partial html file in a container via ajax).
I believe Microsoft ASP.NET MVC was able to handle this case, by comparing the previous version of the page with the new requested page, and just returning the portion of the page that really changed. This may be time and CPU-consuming but it just works.
Is any Node MVC Framework managing a similar thing today ? Or is it mandatory to use an SPA Framework when a reactive user interface is required (without any whole page refresh) ?
Thanks in advance !
sails.js! It supports partials as you requested. You don't need to refresh the page, if you send ajax-request or handle the stuff via websockets dynamically.
As per my project requirement i want to develop an Ajax application with GWT Ui-Binder.. for achieving page refreshing automatically while getting content from database..
Remember: withOut click Refresh button (or) any mouse motion.If u aware about this task...can you please give me with any related exmaple..
if you want to refresh automatic, so you may have any condition where you get event of getting data from database like rpc came on success method etc.. then simply call Window.Location.refresh(); there.
I am writing MVC3 web app I need to know at server side when user navigate from one web page to another. I do not need to know from what pages page to which just fact that user navigated. I could find this by adding Session variable to every Home Controller Actions but maybe there is better solution?
Use a global filter attribute for al your controller actions. You can set that attribute in the global asax. In that case you know when an action is hit.
You could try sending AJAX request bound to onbeforeunload browser event.
Basically, it happens on the client side, so the programming should also be in client. Javascript could be the way to go. Though it may deliver some inconvenience to the user.
In the past I have developed large extjs single page applications. Many users get frustrated for not being able to use the Back or Fwd buttons or reload the page.I would also like to warn the user if they navigate away from a page without completing a work flow, and enable users to directly access particular views.
For the next application, I am thinking of using the Codeigniter php MVC framework. It is possible to something similar to this example. I am stucked thinking about the navigation. If I load the ExtJs for each view, that is a significant slowdown.
How best to approach this?
Have a look at the Ext.History class (Ext.util.History on Ext4). With it you can register listeners for changes to the hash:
Ext.History.on('change', function( token ) {
console.log('token changed to: ', token);
});
The Ext.History singleton includes forward() and back() methods for triggering navigation from within the client-side code.
By having only the hash part of the URL change the browser stays on the same page, thus eliminating the need to reload the Ext library.
How this would integrate with your PHP framework I cannot say. I am not familiar with CodeIgniter and your example link goes to a dead page.
Also, do note a caveat with History in that under Ext3 at least it may give you issues with newer browsers. If this is the case an alternative is to code your own History-like solution using the 'hashchange' browser event as illustrated in this answer.
We are using Ajax Update Panel in SharePoint web part to avoid postback, Certainly it is the easiest approach out there to provide AJAX functionality.But at times it feels like the performance is horrible!
Are there any better approach where in you get better performance then AJAX update panel.
If you're interested in better performance then the Update Panel isn't going to help you.
It's purely a User Experience thing!
When you're using the Update Panel:
Browser is still doing the full post
to the server
Server is doing all the usual work
for ALL the web parts on the page
Server graps the HTML inside the
update panel and sends this and
ViewState to browser
Browser replaces ViewState and HTML
inside Update Panel
But Using the Update Panel is very easy and you don't have to know any JavaScript
Using "real" AJAX would mean:
You have to know JavaScript
You have to know/develop Web Services
BUT only the requested functionallity will have to run on the server, so you'll usually get a lot better performance
NEVER EVER EVER user MS Ajax and the update panel. You will be burnt sooner or later.
Instead, use jQuery, and it's AJAX methods.
Why?
A) jQuery is smaller (and therefore faster?)
B) You can do more with jQuery by iteself than ms AJAX
C) Trying to hide AJAX in server controls is a dumb idea from the start
d) Web forms and server controls in general suck - less is more
e) Sooner or later you will need to get down and dirty with AJAX - better to start at a lower level
I suggest instead of using Asp.NET Update Panel. You can create an .ashx file handler that will expose your server side functions. Then with this you can use jQuery and Ajax to call your server side functions. This will be faster and cross browser issues will be kept to a minimum.