Hybrid View

  1. #1
    Sencha User
    Join Date
    Nov 2009
    Posts
    45
    Vote Rating
    1
    rex0098 is on a distinguished road

      0  

    Default help editor grid

    help editor grid


    hello every one i have a problem with my code....
    I'd like my editor grid to send back all data to my data base in a single row even if i only changed one of it's column...
    is that possible??? if so could anyone give me an example....
    I've searched the net for it but i havent found that could help me...the code i have now does work but it only passes the data from the column that was changed....

  2. #2
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    314
    Vote Rating
    11
    Stuart-SwarmOnline will become famous soon enough Stuart-SwarmOnline will become famous soon enough

      0  

    Default


    Is this what you mean?

    Config option of JsonReader:

    writeAllFields : Booleanfalse by default. Set true to have DataWriter return ALL fields of a modified record -- not just those that changed....
    false by default. Set true to have DataWriter return ALL fields of a modified record -- not just those that changed. false to have DataWriter only request modified fields from a record.

  3. #3
    Sencha User
    Join Date
    Nov 2009
    Posts
    45
    Vote Rating
    1
    rex0098 is on a distinguished road

      0  

    Default thank you...

    thank you...


    thank you for the info i got caught up on the grid that i forgot about the config option of jsonwriter silly me lol.....^_^

    but i have another question how can i make 2 column of in a row change data simultaneously??
    see pic:

    Untitled-1.jpg

    first column is the account description and the second is the account code...what i want to do is when i pick a description the account code would also change to its corresponding code. I've got a working code but i just cant figure out how to do it inside the grid...
    [IMG]file:///C:/DOCUME%7E1/rodel/LOCALS%7E1/Temp/moz-screenshot.png[/IMG]

  4. #4
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    314
    Vote Rating
    11
    Stuart-SwarmOnline will become famous soon enough Stuart-SwarmOnline will become famous soon enough

      0  

    Default


    Listen for the afteredit event on the grid and do some checks for the field being edited and if it's the description one then update the code one.

    Code:
    this.on('afteredit', function(e){
    
         if(e.field === 'Description'){
    
               var code = this.getCodeFromDescription(e.value); // get the equivalent code from somewhere, the Combo's store maybe?
               e.record.Code = code;
         }
    
    }, this);
    
    // untested!

  5. #5
    Sencha User
    Join Date
    Nov 2009
    Posts
    45
    Vote Rating
    1
    rex0098 is on a distinguished road

      0  

    Default


    the afteredit event was really helpful thank you...but i can't seem too figure out how to change the account code
    this is my afteredit function:
    Code:
    afteredit: function(e)
     {
         if(e.field == 'CD_account_description' && e.value == 'Accounts Payable')
        {
    
             //this is the part where i get lost ^_^
            var x = e.record.data.CD_account_code;
               // x is the original value of the account code 
        }
     }
    after i change the account description field value to 'Accounts Payable' how can i change the value of x to match my account description to its account code...please give me some more example if you have thank you....

  6. #6
    Sencha Premium Member
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    314
    Vote Rating
    11
    Stuart-SwarmOnline will become famous soon enough Stuart-SwarmOnline will become famous soon enough

      0  

    Default


    Where are you storing the equivalent Account Codes? The simplest (and nastiest...) answer is to do a massive switch or if/else if statement to pick out the right Account Code. However, probably the best way would be to store the AccountCode in the Account Description's combo store and then get it from that.

    Code:
    afteredit: function(e)
     {
         if(e.field == 'CD_account_description' && e.value == 'Accounts Payable')
        {
    
             var editor = e.grid.getColumnModel().getCellEditor(e.Column, e.Row);
    
             // get the index of the selected description record
             var selectedDescriptionIndex = editor.getStore().findExact('Description', e.value);
    
             // get the description record
             var selectedDescription = editor.getStore().getAt(selectedDescriptionIndex);
    
             // assign the Description's accountCode to the grid's record
             record.data.AccountCode = selectedDescription.data.AccountCode;
    
    }
    }
    
    //again, untested and a little bit theoretical!
    Last edited by Stuart-SwarmOnline; 27 Sep 2010 at 1:10 AM. Reason: weird formatting....

Similar Threads

  1. proble in tab key in editor grid with singel editor columnpleace
    By auminfosys in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 14 May 2010, 11:08 PM
  2. Replies: 1
    Last Post: 17 Apr 2009, 5:49 AM
  3. Replies: 1
    Last Post: 17 Apr 2009, 5:49 AM
  4. Adding ContextMenu to the TextArea Editor field of an Editor Grid Panel
    By fakoua in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 11 Sep 2008, 7:06 AM

Thread Participants: 1