Welcome Guest, Not a member yet? Register   Sign In
Use the DataMapper ORM with Javascript - TagMVC 0.9.2
#1

[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
#2

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




Theme © iAndrew 2016 - Forum software by © MyBB