DateRangePicker set date when selected without apply button

Hello

I am using ASP.NET CORE EJ 2 version 16.1.0.37 (nuget package).

Could you please provide me with an example on how to set the date range in a DateRangePicker when it is selected, without displaying the "apply" and "cancel" buttons?


Kind regards
Phil

3 Replies

PK Prem Kumar Madhan Raj Syncfusion Team June 11, 2018 07:05 AM UTC

Hi Phil, 

Thanks for contacting Syncfusion Support. 

By default, the value property will get updated whenever a date range is selected in the DateRangePicker popup but the input element value will get updated only when the popup is closed (either on document click after selection or by clicking the apply button). However, we can update the input element value with the selected DateRange using the select event without the using “Apply” button as shown in the below code snippet. 

<ejs-daterangepicker id="daterange" select="onSelect"></ejs-daterangepicker> 
 
<script> 
    function onSelect(args) { 
        if (args.endDate) { 
            args.element.value = args.text;// updating input element value when a range is selected 
        } 
    } 
</script> 
 
<style> 
    /*styles to hide the footer (apply cancel buttons)*/  
    .e-daterangepicker.e-popup .e-footer { 
        display: none; 
    } 
</style> 


For your convenience, we have attached the sample in the below link. Please check it. 


Please let us know if need further assistance. 

Regards, 

Prem Kumar M


UN Unknown July 5, 2018 01:55 PM UTC

Thank you for your reply.

This is what I was looking for. Thank you a lot.


PK Prem Kumar Madhan Raj Syncfusion Team July 6, 2018 04:42 AM UTC

Hi Phil, 

Most welcome. Please let us know if you need further assistance. 

Regards, 

Prem Kumar M 


Loader.
Up arrow icon