Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    2
    Vote Rating
    0
    judah is on a distinguished road

      0  

    Default onCellUpdated and sending updates back to the server

    onCellUpdated and sending updates back to the server


    I'm having a bit of confusion about posting data back from the editable grid to my server.

    I undestand that updating any of the cells fires the onCellUpdated event and it also updates the XMLDocument in the Document Model. However, I'm having difficulty figuring out the proper way to grab the updated data and post it back to the server.

    I'm creating a Data Model with a schema like so:

    Code:
    var schema = {
                    tagName: 'contact',
                    id: 'id',
                    fields: ['first_name', 'last_name', 'phone_home', 'phone_mobile', 'email']
                };
                dataModel = new YAHOO.ext.grid.XMLDataModel(schema);
                dataModel.setDefaultSort(colModel, 1, "DESC");
        		
        		grid = new YAHOO.ext.grid.EditorGrid('editor-grid', dataModel, colModel);
        		grid.render();
        		
        		dataModel.load('/loadContacts.cfm'); 
            }
    This loads up the xml for my grid and displays the grid just fine. Now I want to save changes back to the db (saveContacts.cfm or some such). I think I just need a decent example of adding the listener in the proper place and doing an asynchronous post back.

    Also, what would be best practice here, sending back the xml tree on every change or just sending back a single contact record? I would assume that it would be better to send back a single record, but I'm not sure how I would do that in this case.

    Thanks in advance and kudos to Jack for putting together some awesome code that is teaching me a lot.

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    16
    jack.slocum will become famous soon enough

      0  

    Default


    In my setup, I add a save button to the toolbar to save changes and post the xml document with edits back to the server. In some instances this may not be the best solution.

    You can also do incremental saving as you hinted. The main issue here is manually implementing a buffer so every edit of every cell isn't causing an http call. Do it right can be rather involved.

    Here's an example of what a saving routine might look like. It assumes dataModel is in scope and you have two functions handleSuccess and handleFailure to notify the user.
    Code:
    function onSaveClick(e){
         var xml = dataModel.getDocument();
         var cb = {success: handleSuccess, failure: handleFailure}
         YAHOO.util.Connect.asyncRequest('POST', 'save.php', cb, xml); 
    }

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,496
    Vote Rating
    44
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    The way I update the server on significant events is using DWR.

    If you have a Java backend, I highly recommend it.

    I save column hide/resize events using DWR. I also have a custom DataModel and ColumnModel which pull their data using DWR.

    http://getahead.ltd.uk/dwr/

  4. #4
    Ext User cgp's Avatar
    Join Date
    Mar 2007
    Location
    Novi, MI
    Posts
    12
    Vote Rating
    0
    cgp is on a distinguished road

      0  

    Default Another Way

    Another Way


    An even better way would probably be to update the dataset when the "cursor" is moved via cursorChange. (just set some flag to know when data for that row had changed)

Similar Threads

  1. Help: Sending Ext.tree data back to server (ColdFusion)
    By MBragg in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 16 Aug 2007, 7:09 AM
  2. Error sending xml from grid to Server?
    By franklt69 in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 21 Feb 2007, 1:37 PM
  3. onCellUpdated index
    By pomata in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 16 Jan 2007, 12:14 PM
  4. Tree drag drop server updates
    By seldon in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 13 Jan 2007, 5:30 AM
  5. Sending multiple tree node values to server.
    By rahulmca1@gmail.com in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 10 Jan 2007, 12:22 AM

Thread Participants: 3