CodeIgniter Forums
Use the DataMapper ORM with Javascript - TagMVC 0.9.2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Use the DataMapper ORM with Javascript - TagMVC 0.9.2 (/showthread.php?tid=28335)



Use the DataMapper ORM with Javascript - TagMVC 0.9.2 - El Forum - 03-08-2010

[eluser]Julien Dreux[/eluser]
Hi all,

Announcing TagMVC 0.9.2 beta: The latest version of TagMVC, still in beta, comes with a hot new feature: a Javascript library that allows easy manipulation of models from the front end. You can now call three common functions of the DataMapper ORM:
- exists
- save
- delete (renamed to remove to avoid a conflict with the javascript keywork 'delete')

See the following Javascript code example:

Code:
//create a new album node
var album = new Node('album');

//create a new comment node
var comment = new Node('comment');

//Edit the properties of the new nodes
album.name="A new album";
album.description="This album and its comment will be saved at the same time";
comment.text="A new comment. This comment will be created once the 'save' function is called.";

//Save the models, create the new relationship and pass in a
//callback function. The return code will tell us if the operation was successful.
album.save(comment, function(data){alert("Save operation done, and the return code was: "+data.returnCode);});

Library download and set up instructions can be found on the TagMVC homepage. Final release and complete documentation coming soon.

Cheers,

Julien


Use the DataMapper ORM with Javascript - TagMVC 0.9.2 - El Forum - 03-08-2010

[eluser]NachoF[/eluser]
I would like to know what Overzealous thinks of this... it looks like a great idea.