1. #1
    Ext User
    Join Date
    Nov 2008
    Posts
    17
    Vote Rating
    0
    yekurt is on a distinguished road

      0  

    Question editorgridpanel in formpanel need to post all rows as array within the form

    editorgridpanel in formpanel need to post all rows as array within the form


    hi I am a newbie in extjs,

    I need a sample to post all the data in the store of my editorgridpanel, within the form

    I am using browser submit not ajax and have several other components in the form together with the grid,

    my editor grid works good inside I DD rows from another grid panel and let the user edit the added rows, and when save button is pressed, I wanna post the editorpanel values like
    editorrows[
    [1,2,true,'yes'],
    [2,3,false,'yes'],
    ]

    I add name property in editor option of the column model but it did not work when form submitted, it send only 'one' modified value in that column like column1='sth'

    need some guiding please

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    40
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    I would copy the data from the store a hidden field, e.g.

    Code:
    var rows = [];
    store.each(function(r){
      var row = [];
      store.fields.each(function(f){
        row.push(r.get(f.name));
      });
      rows.push(row);
    });
    Ext.getCmp('id-of-hidden-field').setValue(Ext.encode(rows));

  3. #3
    Ext User
    Join Date
    Nov 2008
    Posts
    17
    Vote Rating
    0
    yekurt is on a distinguished road

      0  

    Default


    thanks a lot it works but the thing it sends a jason encoded string
    but not an arrayofarrays
    any other encoding utility in EXt to encode object as arrays to put into an array input in the form ?

    Another question is that there exists an option in basicform "standardSubmit" but i guess it does not post the params option and baseParams OR I could not find how to do it



  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    40
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    1. A standard POST only has name/value pairs. How would you expect to post an array of arrays?

    2. A standard submit indeed only submits the form elements and not any baseParams etc.

  5. #5
    Ext User
    Join Date
    Nov 2008
    Posts
    17
    Vote Rating
    0
    yekurt is on a distinguished road

      0  

    Default


    umm, well then it means I am gonna add hidden inputs to the form with names colum1[] column2[], or use ajax request and success/failure actions to decide on what to do with the response, the second one is easier I think

    I found that php 5.2 has json decode/encode extension that will help me a lot

    thank u very much Condor, for your attention and replying to my beginner class questions

  6. #6
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996
    Vote Rating
    1
    mjlecomte will become famous soon enough

      0  

    Default


    There's another way presented here:
    http://extjs.com/learn/Ext_FAQ_Grid#Grid_within_form

    If you use standard submit then the params won't be included when the form is submitted, you have to use hidden fields if you want to use standard submit.