Default Value with GridNumericColumn

In datagrid we have a GridNumericColumn, wiht the default value 0, i would like to see null or empty like a GridTextColumn. Is there a way to achieve the purpose?

Otherwise a way to use Numeric keyboard in a GridTextColumn.

Best 
Alberto C.

3 Replies

DS Divakar Subramaniam Syncfusion Team June 6, 2018 05:43 AM UTC

Hi Alberto, 
 
Thanks for contacting Syncfusion Support. 
 
In GridNumericColumn, you can able to provide the null value as like in GridTextColumn. For this, you need to set GridNumericColumn.AllowNullValue property as “true”. Please refer the below code snippet, 
 
<sfgrid:SfDataGrid.Columns> 
    <sfgrid:GridNumericColumn MappingName="OrderID" HeaderText="Order ID" AllowNullValue="True"/> 
</sfgrid:SfDataGrid.Columns> 
 
If you set this property as true, then you can provide null value by default or you can edit and commit null values in GridNumericColumn at runtime. We have prepared a simple sample for your reference and you can download the same from the below link, 
 
Please refer the below UG link to know more about the features of GridNumericColumn, 
 
Regards, 
Divakar. 



CR craftindo September 27, 2024 11:50 PM UTC

hi Divakar,

I'm having difficulties in "entering a null" into a GridNumericColumn. 

If i press delete, after pressing enter the value becomes 0!.

Basically my problem is how to enter NaN (not a number) or infinity.

I can display  ∞ as shown in example:

https://support.syncfusion.com/kb/article/14198/how-to-display-positive-and-negative-infinity-values-in-gridnumericcolumn-wpf-datagrid


But, i can only achieve during initialization. Once the user change into a number, I don't know how to change back to infinity. My idea is to enter NULL. But I don't know what to press to enter null.


I have tried:

backspace, delete, th



SD Sethupathy Devarajan Syncfusion Team September 30, 2024 10:47 AM UTC

Hi CraftIndo,


It is clear that after pressing the delete key and then pressing the enter key, the value becomes 0. Please note that you need to set the following in your sample to overcome this issue. First and foremost, the numeric column property defined in the model class needs to be a nullable type. Secondly, you can set the AllowNullValue="True" in the GridNumericColumn. We have shared a simple sample and demo video for your reference.


Code snippet:

<syncfusion:GridNumericColumn MappingName="OrderID"

                               HeaderText="Order ID"

                               NullText="∞"

                               AllowNullValue="True"

                            />


Please note that if you set NullText in the GridNumericColumn, it will be applied after the enter key is pressed following a deletion. Otherwise, it will remain blank.



Regards,

Sethupathy D.


Attachment: XamarinBehaviouSolution_(2)_af9821c3.zip

Loader.
Up arrow icon