Skip Navigation LinksHome > View Post

RIA/JS: Buffer, Commit or Revert – the choice is yours

Here is the second in a series of webcasts about the RIA/JS project. This extends from the last webcast (RIA/JS- The barebones demo) and switches from implicit-commit to look at the bufferChanges: true mode.

It’s only 8 minutes, so check it out – you can download the original to your ‘device’ of choice from vimeo here: http://www.vimeo.com/30170543 (the link to download is on the right halfway down the page).

 

Here is the code that I entered into the ‘console’ during the demo for reference (but watch the video, ok?).

var contacts = [];

var ds = $([contacts]).dataSource({
  serviceUrl: '/RiaJs-Demo1-ContactService.svc',
  queryName: 'GetContacts',
  bufferChanges: true });

ds.refresh();

$.observable(contacts[0]).setProperty('FirstName' : 'Barry');

ds.revertChanges();

$.observable(contacts).insert(0, {
  'FirstName' : 'Erik', 
  'LastName' : 'Porter'
});

$.observable(contacts[0]).setProperty('FirstName' : 'Jonjo');

ds.commitChanges();

Back soon with more…

Tags:

 
Josh Post By Josh Twist
5:20 PM
07 Oct 2011

» Next Post: Building SPA Applications - the webcasts
« Previous Post: RIA/JS: The barebones demo

Comments are closed for this post.

Posted by Ido Ran @ 14 Oct 2011 2:58 PM
Hi,
Very nice demo.
The only thing I will like to add here is that SproutCore library is doing exactly this same thing old 3 or more years ago.
The fact you have to write observable... for every small property change show that you have very long way to go.
Which brings me to my question: why not use SproutCore and customize it for your needs? I'm sure you can take advantage of SC and I'm also pretty sure you can contribute back to SC which will make it even better framework.

That's what I think - Hope it will be help to you.

Thank you,
Ido.

Posted by Ankhar @ 17 Oct 2011 7:37 PM
What about delete? How do I delete entities?

© 2005 - 2014 Josh Twist - All Rights Reserved.