This is a migrated thread and some comments may be shown as answers.

Accept value in EditTemplate on 'OK'

1 Answer 11 Views
MonthYearPicker
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 08 Aug 2019, 11:02 PM

I'm attempting to use the RadMonthYearPicker inside of a RadGrid EditItemTemplate in BatchEdit mode and I'm having an issue getting the picker to accept and exit all forms of it's editors when the user clicks 'OK'

I've attached a screenshot to help illustrate what I mean.

I have a OnBatchEditCellValueChanged function that then validates the date selected and pulls some DB values to other columns.

I have everything working like I want it accept when using the picker you have to manually click off the row before the changed event will fire.

I've tried several different methods of moving the cursor, setting focus, blurs, saving the table via batch manager and I'm sure a few other things and haven't had success yet.

Any direction at this point would be much appreciated. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Attila Antal
Telerik team
answered on 13 Aug 2019, 04:16 PM

Hi Michael,

 

Try the following:

Markup code - Assuming the following TemplateColumn where the RadMonthYearPicker is wired up to its PopupClosing client-event. This event fires when the OK button is clicked.

<telerik:GridTemplateColumn>
    <EditItemTemplate>
        <telerik:RadMonthYearPicker ID="RadMonthYearPicker1" runat="server">
            <ClientEvents OnPopupClosing="OnPopupClosing" />
        </telerik:RadMonthYearPicker>
    </EditItemTemplate>
</telerik:GridTemplateColumn>

 

JavaScript - OnPopupClosing event handler close the BatchEditing Manager:

<script type="text/javascript">
    function OnPopupClosing(sender, args) {
        var grid = $find('<%= RadGrid1.ClientID %>');
        var batchManager = grid.get_batchEditingManager();
        var editedRow = sender.get_element().closest('tr');

        setTimeout(function () {
            batchManager._tryCloseEdits(editedRow);
        });
    }
</script>

 

Kind regards, Attila Antal
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MonthYearPicker
Asked by
Michael
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or