Results 1 to 4 of 4

Thread: How to save new data or changed data back to server side!

  1. #1

    Question How to save new data or changed data back to server side!

    I wanna know how to save changed data or newly created data back to the file(server side or an local xml file) which I loaded through httpProxy. I used editorGrid as my basic grid. I looked through Ext documentation and found commitChange function in Store class, but I didn't know how to use it and make it work. Could anyone show a demostration on it? thks!!

    By the way, I wanna use this grid to select several records and delete them, how can I do that, getAt and getById functions are insufficient to fulfill my purpose.

  2. #2

    Default

    Quote Originally Posted by Smash_hit View Post
    I wanna know how to save changed data or newly created data back to the file(server side or an local xml file) which I loaded through httpProxy. I used editorGrid as my basic grid. I looked through Ext documentation and found commitChange function in Store class, but I didn't know how to use it and make it work. Could anyone show a demostration on it? thks!!

    By the way, I wanna use this grid to select several records and delete them, how can I do that, getAt and getById functions are insufficient to fulfill my purpose.
    I'm also interested in saving changed data.
    Do you find any solution?
    Thanks


  3. #3

    Default

    Maybe you can put your selected data into an form, then do whatever operation you want.

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890

    Default

    It's really up to your programming and design abilities, but creating XML from a Store has been discussed many times.

    Here is a function that will create an XML element from a Record:

    Code:
    Ext.override(Ext.data.Record, {
        asXml : function(rowIndex) {
        	var r = this.store.reader.meta;
        	var elName = r.record;
        	var result = "<" + elName + " id=\"" + this.id + "\">";
       		this.fields.each(function(f) {
       			result += "<" + f.name;
       			if (f.type && f.type !== "auto") {
       				result += " type=\"" + f.type + "\"";
       			}
       			result += ">" + this.get(f.name) + "</" + f.name + ">";
       		}, this);
         	return result + "</" + elName + ">";
        }
    });
    If you add a listener for the Store's update event, the handler be invoked for each modified Record when you call commit. and will be passed each modified record.

    Convert them to XML, concatenate them up into a document string, add the correct XML tags to wrap it, and post it usnig Ext.Ajax. Read the docs on that, it's easy.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •