BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
Hi Tejaswini,
Thanks for using Syncfusion products.
Query 1: How can I get the timepicker while adding and editing the records in dialogtemplate in syncfusion grid.
We have analyzed your code snippet and found that you have rendered the TimePicker control to unknown element ID (#Gridmodified_in_time). We would like to let you know that when we are using dialog template edit mode, we can directly render the controls with its original element id (#modified_in_time) in the actionComplete event and there is no need to append the Grid id with the template control id (#Grid + modified_in_time). Please refer the below code snippet for further details.
<script id="template" type="text/x-jsrender"> <table class="col-md-12" cellspacing="10"> ------ ------ <tr> <td style="text-align: right;"> Modified In Time </td> <td style="text-align: left"> <input id="modified_in_time" class="col-lg-6" value="{{:modified_in_time}}" /> </td> </tr> <tr> <td style="text-align: right;"> Modified Out Time </td> <td style="text-align: left"> <input id="modified_out_time" class="col-lg-6" value="{{:modified_out_time}}" /> </td> </tr> ------- ------- </table> </script> <script type="text/javascript"> angular.module('regulation', ['ejangular']).controller('regularization_controller', function ($scope) { ------- ------- $scope.actionComplete = function actionComplete(args) { if (args.requestType == "beginedit" || args.requestType == "add") { $("#modified_in_time").ejTimePicker({ timeFormat: "hh:mm tt" }); $("#modified_out_time").ejTimePicker({ timeFormat: "hh:mm tt" }); ------- ------- } } }); </script> |
Query 2: While editing the time fields, there should be values for time(values before updating) in respective fields(modified in time and out time)
We can set the value with the template format “{{:modified_in_time}}” field in the input element to achieve your requirement. Please refer the above code snippet for further details.
For your convenience we have created a simple sample from your code snippet and the same can be downloaded from the below link.
Sample Link: http://www.syncfusion.com/downloads/support/directtrac/118445/TimePickerDialogTemplateEditing-1652808676.zip
Please let us know if you have any concerns.
Regards,
Ajith R
Hi Tejaswini,
Thanks for the update.
From your code snippets we found that in Editing Template you have not set the attribute “value” for TimePicker field which may be the cause of the issue. So we suggest you to set “value” attribute in Editing Template to resolve your issue. Please refer the following code snippets.
<script id="template" type="text/x-jsrender"> ... <td style="text-align: right;"> Modified Out Time </td> <td style="text-align: left"> <input id="modified_out_time" class="col-lg-6" value="{{:modified_out_time}}" /> </td> </script> <div ej-grid id="Grid" e-editsettings-dialogeditortemplateid="#template" ... </div> |
Alternatively, if you are unwilling to set value attribute in template, then you can set the current record value to TimePicker Control in “actionComplete” Grid event using “value” TimePicker property. Please refer the following code snippets.
$scope.actionComplete = function actionComplete(args) { ... var rec = this.model.currentViewData[args.rowIndex]; //Getting current record based on row Index $("#modified_in_time").ejTimePicker({ timeFormat: "hh:mm tt", value: rec.modified_in_time }); } |
Please let us know if you need any further assistance.
Regards,
Alan Sangeeth S