We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Inline Editor does not format intial value correctly when a custom format exists

Hi,

I am having problems with the InLine Editor formatting the initial value of a custom formatted numeric text box. See code below where I have tested it against the standard NumericTextBox.

              //Numeric Text Box
                        var numeric = new ej.inputs.NumericTextBox({
                            // sets the format using custom format string `#`
                            format: 'PREFIX ###.##',
                            value: 10.56,
                            placeholder: 'Custom format string #',
                            floatLabelType: 'Auto'

                        });

                        numeric.appendTo('#numeric');

                        //Inline Edtior
                        var numeric1 = new ej.inplaceeditor.InPlaceEditor({
                            mode: 'Inline',
                            type: 'Numeric',
                            model: {
                                format: 'PREFIX ###.##',
                                placeholder: 'Purchase Order Total',
                                value: 10.56,
                                floatLabelType: 'Auto'
                            },
                            value: 10.56,
        
                        });

                        numeric1.appendTo('#inline');


see: http://www.youtube.com/watch?v=CQ0C1veGtuo

As you can see if I try and set a non numeric value to the inline editor the value gets lost on edit.

Criag


3 Replies

PO Prince Oliver Syncfusion Team March 25, 2019 04:03 AM UTC

Hello Craig, 

Greetings from Syncfusion support. 

We have analyzed your sample code and were able to replicate the reported scenario. If we set both value and model value property in an In-place Editor component, model value property will be overridden by editor value property. This is because it has high priority and model property is used to customize the properties of integrated EJ2 controls. EJ2 NumericTextBox accepts value as `number` type, so you must specify number type only. 

To achieve your requirement, remove the In-place Editor’s value property and use emptyText property for displaying initial value in the editor. The emptyText property value will be applied, when the editor value property has null value and it is used like placeholder. 


Let us know if you have any concern. 

Regards, 
Prince 



CR Craig March 25, 2019 07:10 AM UTC

Hi,

I can confirm that this resolves my problem.

Thanks

Craig



PO Prince Oliver Syncfusion Team March 25, 2019 08:31 AM UTC

Hello Craig, 

Thank you for the update. We are glad that the issue is resolved in your end. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon