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.
Unfortunately, activation email could not send to your email. Please try again.

ej.Grid.EditingType.Numeric should not allowed negative numbers(like -1,-2,etc..)

Thread ID:

Created:

Updated:

Platform:

Replies:

120524 Sep 23,2015 09:07 AM Sep 24,2015 07:44 AM JavaScript 1
loading
Tags: ejGrid
Rakesh Advani
Asked On September 23, 2015 09:07 AM

hello,

we use field like port number

{ field: "port", headerText: "portNumber", editType: ej.Grid.EditingType.Numeric},

this is working fine but it allows negative numbers(like -1,-2).

i do not want to allow negative number.
so is there any way which allows only positive numbers and 0.

please do not use validationRules.
we do not require at validation time. 

Prasanna Kumar Viswanathan [Syncfusion]
Replied On September 24, 2015 07:44 AM

Hi Rakesh,

Thanks for contacting Syncfusion Support.

Your requirement have been achieved by the editParams property of ejGrid. To avoid negative numbers in numeric textbox, we suggest you to intialize minValue as 0 in editParams.

Please find the following code example and sample,

<script type="text/javascript">

        $(function () {

            $("#Grid").ejGrid({

                // the datasource "window.gridData" is referred from jsondata.min.js

                dataSource: window.gridData,

                allowPaging: true,

                editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true },

                toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] },

                columns: [

                       { field: "OrderID", headerText: "Order ID", isPrimaryKey:true, textAlign: ej.TextAlign.Right, width: 65 },

                       { field: "CustomerID", headerText: "Customer ID", width: 90 },

                       { field: "ShipCity", headerText: "Ship City", width: 90 },

                       { field: "Freight", headerText: "Freight", width: 90, textAlign: ej.TextAlign.Right, format: "{0:C}", editType: ej.Grid.EditingType.Numeric, editParams: { minValue: 0 } },

                       { field: "ShipCountry", headerText: "Ship Country", width: 90 },

                       { field: "EmployeeID", headerText: "Employee ID", width: 90, textAlign: ej.TextAlign.Right }

                ]

            });

        });
    </script>


 Sample Link: http://www.syncfusion.com/downloads/support/forum/120524/ze/Html_Encode_Feature1899179791

Regards,
Prasanna Kumar N.S.V

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;