-
23 Sep 2010 11:53 PM #1
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....
-
24 Sep 2010 2:38 AM #2
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.
-
24 Sep 2010 6:22 PM #3
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]
-
26 Sep 2010 2:39 AM #4
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!
-
26 Sep 2010 9:36 PM #5
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:
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....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 } }
-
27 Sep 2010 1:09 AM #6
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 Stoot98; 27 Sep 2010 at 1:10 AM. Reason: weird formatting....
-
27 Sep 2010 1:54 AM #7
again thank you for the quick reply..sadly i used the nastiest way to do it..^_^
but that's ok because i'm not working with that many account codes to begin with so that's fine with me and
my account code fiels is not a combobox either its just a plain numberfield..^_^
it's working just fine now...thank you for all your help.....but i have another question..
Untitled-1.jpg
i have an amount column and i want to show their sum at the bottom of the grid or after the last amount is it possible??and i was also thinking of putting in at the bottom bar..please give me your opinion...thank you again
-
27 Sep 2010 2:00 AM #8
Check out the Grid Summary Plugin (http://www.sencha.com/forum/showthre...221#post111221) (latest code is always on Post#9)
It's really good and easy to implement.
-
30 Sep 2010 6:54 PM #9
hello again mr.stoot98 i have not yet got the hang of using the plugin you
referred but its ok i'll figure it out soon..
i have a question about the the grid you've helped me with...when i select an account description the account code changes as well but their cell does not become dirty so when i click on the save button and my grid reloads it still have the same value not the once i selected. here is the code that i used:
i used the commit function to change the account code value when i select an account description but i think it only changes the value in the cell but not on the store.is there any other function function i can use? thank you again.... ^_^Code:if(e.field == 'CD_account_description' && e.value == 'Owner Capital') { var x = e.record.data.CD_account_code = 301; e.record.commit(); }
-
1 Oct 2010 3:01 AM #10
By calling e.record.commit() you are marking the record as 'clean' (i.e. not dirty) and so it won't be included in the next Store save.
Similar Threads
-
proble in tab key in editor grid with singel editor columnpleace
By auminfosys in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 14 May 2010, 11:08 PM -
[CLOSED][3.0 RC1][DUP] Row Editor Grid can't show Editor
By peacock in forum Ext 3.x: BugsReplies: 1Last Post: 17 Apr 2009, 5:49 AM -
[CLOSED][3.0 RC1][DUP] Row Editor Grid can't show Editor
By peacock in forum Ext 2.x: BugsReplies: 1Last Post: 17 Apr 2009, 5:49 AM -
Adding ContextMenu to the TextArea Editor field of an Editor Grid Panel
By fakoua in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 11 Sep 2008, 7:06 AM


Reply With Quote