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
close icon

Editing numeric values with decimals

Hello,

I configure the numeric values this way:

columnaGrid.NumericEditOptions = new EditorProperties();
columnaGrid.NumericEditOptions.DecimalPlaces = 2;
columnaGrid.NumericEditOptions.Locale = "es-ES";

And, when a cell is edited, the decimal part is truncated: 15,25 -> 15,00.

Thanks!



5 Replies

MK Mahalakshmi Karthikeyan Syncfusion Team February 24, 2016 01:29 PM UTC

Hi Jorge,

Thanks for contacting Syncfusion support.

We can set the decimal places to numeric edit fields in TreeGrid. We need to define decimal places for the numeric field in the following format.

protected void Page_Load(object sender, EventArgs e)

        {

            //…

            var index1 = this.Treegrid.Columns.FindIndex(col => col.Field == "PercentDone");

            this.Treegrid.Columns.ElementAt(index1).NumericEditOptions = new EditorProperties() { DecimalPlaces = 2 };    

}

Also we no need to set locale for separate numeric field as you have done in your code example. Once we set locale to the control it will take to all its fields.

We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericField1556664569

Regards,

Mahalakshmi K.



JP Jorge Pampin February 24, 2016 05:29 PM UTC

Hello,

The TreeGrid control is still truncating the decimals of the values with 'es-ES' localization.

Thanks


MK Mahalakshmi Karthikeyan Syncfusion Team February 25, 2016 10:11 AM UTC

Hi Jorge,

We were not able to reproduce any issue in numeric field when locale applied to the TreeGrid. Please fine the below code example for details.

[ASPX]

<script>

       ej.TreeGrid.Locale["es-ES"] = {

           toolboxTooltipTexts: {

               addTool: "añadir",

               editTool: "editar",

               updateTool: "actualizar",

               deleteTool: "borrar",

               cancelTool: "cancelar",

               expandAllTool: "expandir todo",

               collapseAllTool: "expandir todo",

               pdfExportTool: "exportación a PDF"

           },

       }

   </script>


<ej:treegrid ID="Treegrid" runat="server" Locale="es-ES" //… >

//…

</ej:treegrid>  


[CS]

protected void Page_Load(object sender, EventArgs e)

        {

            //…

            var index1 = this.Treegrid.Columns.FindIndex(col => col.Field == "PercentDone");

            this.Treegrid.Columns.ElementAt(index1).NumericEditOptions = new EditorProperties() { DecimalPlaces = 2 };    

}

We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/NumericFieldWithLocale231505062

If you still facing any issue, please get back to us by modifying this sample along with the replication procedure to reproduce it.

Regards,

Mahalakshmi K.



JP Jorge Pampin February 25, 2016 11:50 AM UTC

Hello,

You need to change this to show the characater ',' as decimal separator:

this.Treegrid.Columns.ElementAt(index1).NumericEditOptions = new EditorProperties() { DecimalPlaces = 2, Locale=this.Treegrid.Locale };

Then, the cell truncates the decimals of the values.

Thanks!


MK Mahalakshmi Karthikeyan Syncfusion Team February 26, 2016 12:51 PM UTC

Hi Jorge,

Sorry for the inconvenience caused.

We were able to reproduce the issue while setting locale to the numeric field in TreeGrid. Hence we have also logged an issue report regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents

Please let us know if you require further assistance on this.

Regards,

Mahalakshmi K.


Loader.
Live Chat Icon For mobile
Up arrow icon