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

Validation numeric text box

Hi,

I have two columns: start and end. Both are numeric and I can edit them in cell mode. If in the start cell I have value 10 I want to disable values smaller than 10 in end cell. How can I achieve this?

Best regards,
Tomasz Tomczykiewicz

13 Replies

PP Pooja Priya Krishna Moorthy Syncfusion Team December 2, 2019 11:59 AM UTC

Hi Tomasz, 
We can achieve your requirement, by using edit.params in Gantt column property to handle numericTextBox model . When click on the end cell, using focus event of NumericTextBox we are validate and set the min value of start cell value. Hence, we can’t change less than start value. 

Please find the below code example. 
 
 
<ejs-gantt 
   //... 
   :columns= "columns" 
></ejs-gantt> 
  data: function() { 
    return { 
      //... 
      columns: [ 
        //... 
         { field: 'Custom2',width: 100, 
          edit: { 
              params: { value: 0, 
                focus: function(args){ 
                  var ganttobj = document.getElementById('GanttContainer').ej2_instances[0]; 
                  var index = ganttobj.selectedRowIndex; 
                  if(ganttobj.flatData[index].Custom1){ 
                      this.min = ganttobj.flatData[index].Custom1 
                  }           
                } 
              } 
           }, editType: 'numericedit' },        
      ], 
    }; 
  } 
 
Please find the below sample link. 
 
Regards, 
Pooja Priya K. 



TT Tomasz Tomczykiewicz December 2, 2019 01:21 PM UTC

Hi,

Thanks, it's solved my problem.

Best regards,
Tomasz Tomczykiewicz


JS Jonesherine Stephen Syncfusion Team December 3, 2019 07:28 AM UTC

Hi Tomasz, 
Thanks for your update. 
We are happy that issue has been resolved at your end. 
Please let us know if you need further assistance on this. 
 
Regards, 
Jone sherine P S 



TT Tomasz Tomczykiewicz December 10, 2019 10:21 AM UTC

Hi,

I have an issue with this validation. In start cell I have value 10. I inline edit the end cell value to 5 and press enter, the validation doesn't work. But when I click outside the cell, the validation works.

Best regards,
Tomasz Tomczykiewicz


TT Tomasz Tomczykiewicz December 10, 2019 11:05 AM UTC

Additionally, when I leave empty value after editing I have NaN (instead of null).


PP Pooja Priya Krishna Moorthy Syncfusion Team December 12, 2019 09:30 AM UTC

Hi Tomasz, 
Please find the below response. 
S.No 
Query 
Syncfusion Comments 
 
1 
 
 
I have an issue with this validation. In start cell I have value 10. I inline edit the end cell value to 5 and press enter, the validation doesn't work. But when I click outside the cell, the validation works. 
 
 
We can resolve this by setting the value of start cell to validation.min value in the focus event of NumericTextBox control as like below code example. 
 
 
return 
      //...  
      columns: [  
        //...  
      { 
            field: 'Custom2', width: 100, 
            validationRules: { required: true, number: true }, 
            edit: { 
                params: { 
                focus: function (args) { 
                        var ganttobj = document.getElementById('GanttContainer').ej2_instances[0]; 
                        var index = ganttobj.selectedRowIndex; 
                        var minValue = ganttobj.flatData[index].Custom1; 
                       ganttobj.ganttColumns[2].validationRules.min = minValue; 
                    } 
                } 
            }, editType: 'numericedit' 
        },       
   ],  
};  
 
 
 
 
2 
 
 
when I leave empty value after editing I have NaN (instead of null). 
 
We suggest you to use validation required set to true. So that it prevents you from saving empty value. 
 
  
    return 
      //...  
      columns: [  
        //...  
        { 
            field: 'Custom1', validationRules: { required: true, number: true },        
        }, 
      ],  
    };  
 
 
 
Please get back to us if you require further assistance on this. 
 
Regards, 
Pooja K. 
 
 



TT Tomasz Tomczykiewicz December 12, 2019 11:13 AM UTC

Hi,

Thanks for replay, it solved my first problem. But for the second problem, we misunderstood each other. User can leave empty value- I don't want to block this option. Only problem is, when the user leaves empty value it is NaN.


Best regards,
Tomasz Tomczykiewicz


PP Pooja Priya Krishna Moorthy Syncfusion Team December 13, 2019 04:11 PM UTC

Hi Tomasz, 
We can resolve this by setting the type of column as number in the column definition. Please find the below code example. 
  
    return 
      //...  
      columns: [  
        //...  
        { 
            field: 'Custom1', type:”number”},        
        }, 
      ],  
    };  

Regards, 
Pooja Priya K. 
 



TT Tomasz Tomczykiewicz December 16, 2019 09:24 AM UTC

Hi,

Your provided solution doesn't resolve my problem. I can't delete a value, it returns to the previous value (see attached gif).

Best regards,
Tomasz Tomczykiewicz


Attachment: Kapture_20191216_at_10.21.02.gif_c94b3c45.zip


PP Pooja Priya Krishna Moorthy Syncfusion Team December 17, 2019 01:01 PM UTC

Hi Tomasz, 

We are also able to reproduce the issue, when allowUnscheduledTasks property is disabled. We logged a bug report for this. You can track its status from below feedback link. 
We will fix this issue and include in our weekly patch release which is expected to be rolled out on January 2, 2020. 
Until then we appreciate your patience. 

Thanks, 
Pooja K 



PP Pooja Priya Krishna Moorthy Syncfusion Team December 24, 2019 01:54 PM UTC

Hi Tomasz, 
Thanks for your patience. 
We have fixed the reported issue. Please find the release notes from below link. 
Please upgrade your Gantt packages to the highest version v17.4.40. We have prepared a sample with latest source, please find the sample from below link. 

Regards, 
Pooja K. 



TT Tomasz Tomczykiewicz December 27, 2019 10:31 AM UTC

Hi,

Thanks, it's solved my problem.

Best regards,
Tomasz Tomczykiewicz


KR Karthikeyan Raja Syncfusion Team December 30, 2019 11:32 AM UTC

Hi Tomasz, 
  
Most welcome. We are happy that your issue has been resolved. Please get back to us if you need any assistance on this. 
  
Regards, 
Karthikeyan Raja. 


Loader.
Live Chat Icon For mobile
Up arrow icon