1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    pan43 is on a distinguished road

      0  

    Default Submit grid store

    Submit grid store


    I have a form with 3 editable grids, i want to submit the Ext.data.Store into .php file. What should i do? here is the code

    [PHP]Ext.onReady(function()
    {

    function formatDate(value){
    return value ? value.dateFormat('M d, Y') : '';
    }
    ;
    var fm = Ext.form;
    sm = new Ext.grid.RowSelectionModel();
    var cm = new Ext.grid.ColumnModel([{
    id:'chname',
    header: "

  2. #2
    Sencha - Community Support Team VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501
    Vote Rating
    7
    VinylFox will become famous soon enough VinylFox will become famous soon enough

      0  

    Default


    Are you needing to submit all the data at once, or after each cell edit?

    You might want to check out this tutorial to get a feel for grid editing, however it can be quite overwhelming.

    http://extjs.com/learn/Tutorial:Ext2...itor_PHP_MySQL

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    pan43 is on a distinguished road

      0  

    Default


    i want to submit all information at once.even if information not change.

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    And how would you like your data that is send to the server to be formatted?

  5. #5
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    pan43 is on a distinguished road

      0  

    Default


    i got 3 grids and i want 3 requests to diffirent php scripts

  6. #6
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    pan43 is on a distinguished road

      0  

    Default


    i just want to see simple example how can i submit data.store, and sorry for my english

  7. #7
    Sencha - Community Support Team VinylFox's Avatar
    Join Date
    Mar 2007
    Location
    Baltimore, MD
    Posts
    1,501
    Vote Rating
    7
    VinylFox will become famous soon enough VinylFox will become famous soon enough

      0  

    Default


    I think something like this should work (never tried it with XML data though)

    Inside your button handler...
    Code:
    form1.getForm().submit({
      params: {
        data: Ext.util.JSON.encode(grid.getStore().reader.jsonData)
      }
    ...
    });
    Its likely that you will have to commit changes to the store before hand, or perform some other actions, but this should get you headed in the right direction.

    If you want to submit XML data instead of JSON, then im not sure what you need to do - personally I never use XML data.

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    87
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Example (simply JSON encode the records):

    Code:
    Ext.Ajax.request({
    	url: 'submit.php',
    	method: 'POST',
    	params: Ext.encode(grid.getStore().getRange()),
    	callback: function(options, success, response) {
    		// do stuff
    	}
    });

  9. #9
    Ext User
    Join Date
    Jan 2008
    Posts
    14
    Vote Rating
    0
    pan43 is on a distinguished road

      0  

    Default


    thanks

  10. #10
    Ext JS Premium Member
    Join Date
    Aug 2007
    Location
    Germany
    Posts
    139
    Vote Rating
    1
    Spirit is on a distinguished road

      0  

    Default


    Code:
    Ext.encode(grid.getStore().getRange());
    Does not work for me, i get the following error:
    too much recursion ?!