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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Custom Validation Get all fields

Thread ID:

Created:

Updated:

Platform:

Replies:

145171 Jun 11,2019 07:58 AM UTC Jun 13,2019 07:01 AM UTC React - EJ 2 3
loading
Tags: Grid
License Admin
Asked On June 11, 2019 07:58 AM UTC

Hi,

How can we get values of whole grid line while doing custom validation? 
say for example i am having 3 columns Name, Duration and factor i need to add custom validation in factor as it should not be more than Duration so i need both value i.e duration and factor.

Thavasianand Sankaranarayanan [Syncfusion]
Replied On June 12, 2019 09:12 AM UTC

Hi Sandeep, 

Thanks for contacting Syncfusion support. 

We have validated your requirement. You can achieve your requirement by using the below way. Please find the below code snippet and sample for your information. 

export class Editing extends SampleBase { 
    constructor() { 
        super(...arguments); 
        this.toolbarOptions = ['Add', 'Edit','Update', 'Delete']; 
        this.editSettings = { allowEditing: true, allowAdding: true, allowDeleting: true,}; 
        this.validationRules = { required: true }; 
        this.orderidRules = { required: true, number: true }; 
        this.pageSettings = { pageCount: 5 }; 
        this.customerIDRules = { 
    minLength: [this.customFn, 'Need atleast 5 letters'], 
    required: true 
  }; 
    } 
     customFn(args) { 
      var editRow = parentsUntil (args.element, 'e-row'); //here you can get the values the other input field value 
      return getValue('value', args).length >= 5; 
  }; 
     
    render() { 
        return (<div className='control-pane'> 
        <div className='control-section'> 
         . . . 
              <ColumnDirective field='CustomerName' headerText='Customer Name' width='150' validationRules={this.customerIDRules}></ColumnDirective> 
      . . . 
          </GridComponent> 
        </div> 
      </div>); 
    } 

render(<Editing />, document.getElementById('sample')); 


Please get back to us if you need further assistance. 

Regards, 
Thavasianand S. 


License Admin
Replied On June 12, 2019 11:48 AM UTC

Hi,

Thanks.

In the above example can you please get the orderId value as i am not getting how to retrieve values from editRow.

Pavithra Subramaniyam [Syncfusion]
Replied On June 13, 2019 07:01 AM UTC

Hi Sandeep, 
 
You can get the other field values in the edit row by using the below way. Please refer to the below code example and sample link for more information. 
 
[index.jsx] 
customFn(args) { 
      var editRow = parentsUntil (args.element, 'e-row'); //here you can get the values the other input field value 
      var Grid_Id = parentsUntil (args.element, 'e-grid').id; 
      console.log(editRow.querySelector("#"+Grid_Id+"OrderID").value);   
      return getValue('value', args).length >= 5; 
  }; 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon