Removing the RuleSetValidation using jquery in devExtreme dataGrid

Webner Solutions
2 min readMay 5, 2020

--

Removing the RuleSetValidation using jquery in devExtreme dataGrid
Removing the RuleSetValidation using jquery in devExtreme dataGrid

Introduction of Validation

Validation is the most important part of any programming language. The validation avoids saving invalid data in the database. It does not check the accuracy of the data but checks the format of data. With the help of validation, we can directly check if the field is blank or have invalid data. Sometimes we apply the validation in the MVC model and make some columns read-only to save the data into a database using Devextreme Datagrid. It gives an error message and the data is not saved in the database.

It provides lots of features that we can use according to our needs. In this case “Migration Id” column is a read-only column and it’s getting a validation error when we try to save data into the database. The “CustomizeColumns” configuration feature of devextreme dataGrid is used. In the given example “removeValidationRules” function in javascript is made and call this function in the Datagrid “CustomizeColumns” to remove validation in the “MigrationId” column.

DataGrid Code in MVC

@(Html.DevExtreme().DataGrid()
.ID(“gridContainer”)
.ShowBorders(true)
.Columns(columns => {
columns.AddFor(m => m.MigrationId);
columns.AddFor(m => m.Name);
columns.AddFor(m => m.IndexFile);
})
.Paging(paging => paging.PageSize(10))
.CustomizeColumns(“removeValidationRules”)
.DataSource(d => d.WebApi().Controller(“DataGridCustomers”).Key(“ID”))
)

JavaScript Code

function removeValidationRules(columns)
{
columns[1].validationRules = null;
}

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Originally published at https://blog.webnersolutions.com on May 5, 2020.

--

--

Webner Solutions
Webner Solutions

Written by Webner Solutions

Our team in Salesforce is very strong, with in-depth knowledge of Salesforce classic and Lightning development as well as the Service cloud.

No responses yet