Accept value in EditTemplate on 'OK'

2 posts, 1 answers
  1. Michael
    Michael avatar
    1 posts
    Member since:
    Jan 2018

    Posted 08 Aug Link to this post

    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. 

  2. Answer
    Attila Antal
    Admin
    Attila Antal avatar
    425 posts

    Posted 13 Aug Link to this post

    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.
Back to Top