First, nice framework.

Having some trouble understanding how to get the changes from a form and
send those changes back to the server.

Here is my code so far and what I have tried.

Form is a simple form with two fields firstName and LastName and a button
Save
The data is being requested and loaded into the form with no problems. 

1)  How do I get the data from the Form?  I assume from the controller model
by using controller.getModel()), is this correct.  In the demo browser you
are declaring a model instance and loading it with data, ie var model =
qx.data.marshal.Json.createModel(data);  but when using remote data and
stores you do not explicitly declare a model so just to make sure in this
case I would declare var mymodel = controller.getModel(), then i can
serialize that to json is my Save function. 

2)  How do I only get changed data, example I only modify firstName as so
only want to send the modified data back to the server.  Is there a function
of the model to get only changed fields?

3) Last sending data back to the server I would call something like
ds.put({id: 290}, myjsonmodel);

On the last one I am unclear of how put parameters are defined, I did not
understand the api, example is the function parameters ds.put(key,fields). 
Where in the docs is the method described showing what parameters each
get,put,post,delete the rest api request accepts? For each option is it just
a string of key/value pairs separated by a comma?

Thank you for any help,
Dan


 var dburl = "http://127.0.0.1:8081/cors/Contact";
        var contacts = {
            getAll: {
                method: "GET",
                url: dburl
            },

            create: {
                method: "POST",
                url: dburl + "/?$method=update"
            },

            getById: {
                method: "GET",
                url: dburl + "({id})"
            },

            update: {
                method: "POST",
                url: dburl + "/?$method=update"
            },

            destroy: {
                method: "POST",
                url: dburl +  "({id})/?$method=delete"
            }
        }

        //Create rest request ds
        var ds = new qx.io.rest.Resource(contacts);

        //Create store
       var store = new qx.data.store.Rest(ds, "getById");
       //create controller
       var controller = new qx.data.controller.Form(null,form);
        //Create store bind all changes to controller model
        store.bind("model", controller, "model");
        //Initiate request
        ds.getById({id: 290})

// serialization and reset /////////
        saveButton.addListener("execute", function() {
            if (form.validate()) {
                debugger;
                alert("You are saving: " +
qx.util.Serializer.toJson(controller.getModel()));
            }
        }, this);




--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Form-binding-remote-data-tp7584235.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to