DateRangePicker and button Apply event click

Hi,
I would need to know if there is a way to intercept the user's click event on the apply button.
Thank you so much for the time you dedicate to me.
Barbara Inzitari

3 Replies

DL Deepa Loganathan Syncfusion Team September 25, 2018 06:03 PM UTC

Hi Inzitari, 

Thanks for contacting Syncfusion Support. 

Yes, the change event of the DateRangePicker component triggers whenever a valid value is selected and apply button is being clicked.  Please check the below code snippet to know how to make use of the change event of the DateRangePicker component and check whether the event is triggered on apply button click. 

@Html.EJS().DateRangePicker("daterange").Width("300px").Change("onChange").Render() 
 
<script> 
    function onChange(args){ 
        //to check whether change event is triggered becuase of apply button 
        if (args.event && args.event.target.classList.contains("e-apply")) { 
            console.log("apply button clicked"); 
        } 
    } 
</script> 
 

We have also attached the sample for your convenience. Please check it. 


If you rather wish to stop the pop up from closing, you can intercept it by using the close event available in Daterangepicker and can be done by setting the args.cancel as true as given below. 



@Html.EJS().DateRangePicker("daterange").Width("300px").Change("onChange").Close("onClose").Render() 
 
<script> 
    function onClose(args){ 
        args.cancel = true; 
    } 
</script> 
 

Please check the below help documents to explore more about DateRangePicker. 

Please let us know if you need any further assistance. 

Regards, 

Deepa L. 



NI nimue September 26, 2018 09:48 AM UTC

Hi Deepa L. ,
thank you very much for your support and for the links you sent me now I understand.
Barbara Inzitari


DL Deepa Loganathan Syncfusion Team September 26, 2018 06:46 PM UTC

Hi Barbara Inzitari,  
 
We are glad that your concerns were resolved.  
Please let us know if need any further assistance.  
 
Regards,  
Deepa L. 


Loader.
Up arrow icon