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

Enable or disable a daterimpicker in grid

Hi
How is possibile via javascript to enable or disable a datetimepicker  in column in a grid ?
Thank you for your support
Franco

3 Replies

JK Jayaprakash Kamaraj Syncfusion Team February 13, 2017 10:38 AM UTC

Hi Franco, 

Thank you for contacting Syncfusion support. 

We have achieved your requirement using actioncomplete event of ejGrid. In this we can disable/enable dateTimePicker using enable/disable method of ejDateTimePicker. Please refer to the below help document,  code example and sample. 





 
<ej-grid id="GridContainer" 
         allow-resize-to-fit="true" 
         allow-sorting="true" 
         allow-text-wrap="true" 
         allow-paging="true" 
         is-responsive="true" 
         datasource="ViewBag.data" action-complete="actioncomplete" 
         enable-responsive-row="true"> 
    ……………… 
 
       <e-column field="CustomerID" header-text="CustomerID" /> 
        <e-column field="EmployeeID" header-text="EmployeeID" /> 
        <e-column field="OrderDate" header-text="OrderDate" type="datetime" edit-type="DateTimePicker" /> 
    </e-columns> 
</ej-grid> 
 
 
<script type="text/javascript"> 
    function actioncomplete(args) { 
         
        if (args.requestType == "beginedit") { 
            if (args.rowData.EmployeeID == 2) 
                $("#GridContainerOrderDate").ejDateTimePicker("disable"); // here we have disbaled dataTimePicker 
            else 
                $("#GridContainerOrderDate").ejDateTimePicker("enable"); // here we have enabled dataTimePicker 
        } 
    } 
</script> 

If we have misunderstood your requirement, then please share more details about your requirement it will help us to provide the prompt solution                                                                              


Regards, 

Jayaprakash K. 



FP franco perduca February 13, 2017 07:57 PM UTC

Thank you it works!!!!

ps there same mistake in you doc

https://help.syncfusion.com/api/js/ejgrid#events:actioncomplete
the param is args.rowData not args.row 

correct ?

Thank you


JK Jayaprakash Kamaraj Syncfusion Team February 14, 2017 01:21 PM UTC

Hi Franco 
 
In actionComplete event we will get args.row and args.rowData. 
 
args.row => Returns the current edited row. 
 
args.rowData = >  returns the Record object (JSON). 
 
We have modified our UG documentation for the particular event(actionComplete) and it will be published shortly. We will let you once it is refreshed online. 
Regards,  
  
Jayaprakash K.   


Loader.
Live Chat Icon For mobile
Up arrow icon