-
15 Mar 2011 10:36 PM #11
We new property need - ThousandSeparator - can be change to any leters.
thanks
-
16 Mar 2011 2:59 AM #12
Last edited by brittongr; 16 Mar 2011 at 3:00 AM. Reason: corrected spelling
Greivin Britton
My Extensions:
Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.
-
17 Mar 2011 5:18 AM #13
It's work very well.
New Property for realization:
currencySymbol can be to BEGIN (as now - before value) and to END (after value).
) nice work!
-
19 Mar 2011 6:42 AM #14
How to unrender on submit
How to unrender on submit
First of all the Numeric field works like a charm for EUR signs. Really great..
Yet, I stumbled upon a problem that if I execute myform.getForm().submit using a button, the rendered value will be passed to my application, not the data. Which is what I should have expected in the first place, I think, but maybe I'm actually doing something wrong.
With the roweditor it is not a problem, as there I pass the parameters using the record.data. Is this same method possible with BasicForm as well and if yes, how do I access my value.
if record.data.myvariable works, would it be as simple as myform.data.myvariable (then I need to debug).
-
19 Mar 2011 9:03 AM #15
Hi sussdorff, let me tell you that is a known issue for me, but it doesn't regards to NumericField and the same thing happens when you use a comboBox like this:
if you add that combo box to your form where you are using Ext.ux.NumericField, i will expect that you see in your params 'My First Name' or 'My Last Name' instead of "1" or "2" when you do a submit, or also you can try this: after the form is rendered you can set a value to numericField and then display it using thisCode:new Ext.form.ComboBox({ name: 'combobox', store: new Ext.data.ArrayStore({ fields:['id', 'display'], data:[[1, 'My First Name'], [2, 'My Last Name']] }), valueField:'id', displayField: 'display', mode:'local', triggerAction:'all', editable:false }),
You will notice they are different and because the ajax request take as param this.form.el.dom at this point the raw value is submitted instead expected value...Code:alert('Value ' + numericField.getValue() + ', RawValue ' + numericField.el.getValue());
In extjs 4 it seems to be an easy way to submit the value using a function to processRawValue but i haven't played with extjs 4 yet, so i handle that using an override of Ext.form.Action.Submit and here is the code:
original code (taken from extjs 3.3.1):
this is my override. You can include this in a helper.js or overrides.js file and use it in all your pages where you are using NumericFieldCode:run : function(){ var o = this.options, method = this.getMethod(), isGet = method == 'GET'; if(o.clientValidation === false || this.form.isValid()){ if (o.submitEmptyText === false) { var fields = this.form.items, emptyFields = []; fields.each(function(f) { if (f.el.getValue() == f.emptyText) { emptyFields.push(f); f.el.dom.value = ""; } }); } Ext.Ajax.request(Ext.apply(this.createCallback(o), { form:this.form.el.dom, url:this.getUrl(isGet), method: method, headers: o.headers, params:!isGet ? this.getParams() : null, isUpload: this.form.fileUpload })); if (o.submitEmptyText === false) { Ext.each(emptyFields, function(f) { if (f.applyEmptyText) { f.applyEmptyText(); } }); } }else if (o.clientValidation !== false){ // client validation failed this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); } },
I really don't know if there is an easy way... but this works for me...Code:Ext.override(Ext.form.Action.Submit, { run: function(){ var o = this.options, method = this.getMethod(), isGet = method == 'GET'; if (o.clientValidation === false || this.form.isValid()) { /*if (o.submitEmptyText === false) {*/ var fields = this.form.items, emptyFields = []; fields.each(function(f){ if (o.submitEmptyText === false) { if (f.el.getValue() == f.emptyText) { emptyFields.push(f); f.el.dom.value = ""; } } else f.el.dom.value = f.getValue(); }); //} Ext.Ajax.request(Ext.apply(this.createCallback(o), { form: this.form.el.dom, url: this.getUrl(isGet), method: method, headers: o.headers, params: !isGet ? this.getParams() : null, isUpload: this.form.fileUpload })); if (o.submitEmptyText === false) { Ext.each(emptyFields, function(f){ if (f.applyEmptyText) { f.applyEmptyText(); } }); } } else if (o.clientValidation !== false) { // client validation failed this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); } } });Greivin Britton
My Extensions:
Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.
-
20 Mar 2011 12:52 AM #16
Works nearly awesome
Works nearly awesome
Thanks a lot Greivin,
your override allows me to correctly save the values
.
Sadly, when saving, it also "unrenders" the form values, so I see the values which have been sent. I thought, oh well, just reload the form again, but that did not help, so I am wondering what I am doing wrong.
Code:budget_form.getForm().submit({ method:'GET', waitTitle:'Connecting', waitMsg:'Sending data...', url:'budget-data', params: { action: 'save_budget', budget_id: '@budget_id@' }, success: function(res){ Ext.Msg.alert('Status', 'Saving successful'); budget_form.getForm().load(); },
-
20 Mar 2011 12:55 AM #17
Works nearly awesome
Works nearly awesome
Thanks a lot Greivin,
your override allows me to correctly save the values
.
Sadly, when saving, it also "unrenders" the form values, so I see the values which have been sent. I thought, oh well, just reload the form again, but that did not help, so I am wondering what I am doing wrong.
The goal is for the end user to continue to see the rendered numeric field once he has hit the submit button. And maybe I should start playing with ExtJS 4.0 instead :-).
Code:budget_form.getForm().load({ url:'budget-data', params: { action: 'get_budget', budget_id: @budget_id@}, failure: function(response){ var result=response.responseText; Ext.MessageBox.alert(result,'could not connect to database'); } });Code:buttons: [{ text: 'Save', handler:function(){ budget_form.getForm().submit({ method:'GET', waitTitle:'Connecting', waitMsg:'Sending data...', url:'budget-data', params: { action: 'save_budget', budget_id: '@budget_id@' }, success: function(res){ Ext.Msg.alert('Status', 'Saving successful'); budget_form.getForm().load(); }, failure: function(result, req){ Ext.MessageBox.alert(result,'could not connect to database'); } }); } }]
-
20 Mar 2011 1:09 PM #18
Well lets see if this one doesn't bring a hidden issue

Forget the last override... try this...
And in your save function you should do it like thisCode://Basic Form Ext.override(Ext.form.Action.Submit, { run: function(){ var o = this.options, method = this.getMethod(), isGet = method == 'GET'; if (o.clientValidation === false || this.form.isValid()) { if (o.submitEmptyText === false) { var fields = this.form.items, emptyFields = []; fields.each(function(f){ if (f.el.getValue() == f.emptyText) { emptyFields.push(f); f.el.dom.value = ""; } }); } Ext.Ajax.request(Ext.apply(this.createCallback(o), { //form: this.form.el.dom, //Commenting this to avoid duplicated parameters url: this.getUrl(isGet), method: method, headers: o.headers, params: !isGet ? this.getParams() : null, isUpload: this.form.fileUpload })); if (o.submitEmptyText === false) { Ext.each(emptyFields, function(f){ if (f.applyEmptyText) { f.applyEmptyText(); } }); } } else if (o.clientValidation !== false) { // client validation failed this.failureType = Ext.form.Action.CLIENT_INVALID; this.form.afterAction(this, false); } } });
Code:{ text: 'Save', handler: function() { var params = simple.getForm().getFieldValues(false); //false to get all fields not only dirty ones params.action = 'save_buget'; params.budget_id = '@budget_id@'; //Other params here simple.getForm().submit( { waitMsg:'Saving Data...', params: params, success: function() { alert('success'); }, failure: function() { alert('failure'); } }); } },Greivin Britton
My Extensions:
Ext.ux.NumericField: Number field with support for currencySymbol, thousand separator, international...
Ext.ux.PagerSizeSelector: A plugin that allows the change page size with just one click.
Ext.ux.FieldAccess: A plugin to let the user know which fields are editable.
-
23 Mar 2011 8:05 AM #19
Features
Features
Hi,
i have made some changes:
1. initComponent for check valid arguments
2. onRender to resolve problem in submit with hidden field
3. currencySymbolPosition argument (before/after)
4. numberFieldAlign argument (left/right)
I hope it is useful
-
30 Mar 2011 12:27 PM #20
Similar Threads
-
Currency / money field with selectable currency
By simplessus in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 22 Jan 2011, 3:24 AM -
Number Field with currency formatting
By JSCoder in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 2 Sep 2009, 9:39 AM -
Currency Symbol in Ext.ND views
By cujo13 in forum Ext.nd for Notes/DominoReplies: 2Last Post: 12 Mar 2009, 6:55 AM -
[FIXED] LabelField shows ":" separator symbol
By Grandiosa in forum Ext GWT: Bugs (1.x)Replies: 2Last Post: 8 Jun 2008, 8:26 PM


Reply With Quote
