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

RadGrid loses the focus when press tab on filter in IE8

1 Answer 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mayur
Top achievements
Rank 1
Mayur asked on 26 May 2014, 09:34 AM
I have a radgrid with search functionality,when i search a record and press tab the cursor gets lost,ideally it should go to next filter column.This is happening only in core IE8.I have attached gif file for more details.Please have a look.



Please Suggest.

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 29 May 2014, 09:00 AM
Hello Mayur,

From what I see in the attached GIF animation, you have enabled the postback on filter for the columns by setting the AutoPostBackOnFilter property to true. Please note that it is rather expected to lose the focus after postback, but you could use the following workaround, which should allow you to set the focus manually.

What you will have to do is to handle the client-side OnRequestStart and OnResponseEnd event of a RadAjaxPanel or RadAjaxManager (depending on your exact scenario) and use the following approach for keeping the ID of the element that should be focused and on response end, focus the element:
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        var elementToFocusID = null;
 
        function requestStart(sender, args) {
            elementToFocusID = document.activeElement.id;
        }
 
        function responseEnd(sender, args) {
            if (elementToFocusID) {
                if (document.getElementById(elementToFocusID)) {
                    document.getElementById(elementToFocusID).focus();
                }
            }
 
            elementToFocus = null;
        }
    </script>
</telerik:RadScriptBlock>
 
<telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" ClientEvents-OnRequestStart="requestStart" ClientEvents-OnResponseEnd="responseEnd">
    <telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" AllowFilteringByColumn="true">
        <MasterTableView AutoGenerateColumns="false">
            <Columns>
                <telerik:GridBoundColumn DataField="ID" ShowFilterIcon="false" AutoPostBackOnFilter="true"></telerik:GridBoundColumn>
                <telerik:GridNumericColumn DataField="NumericValue" UniqueName="NumericColumn" AutoPostBackOnFilter="true" ShowFilterIcon="false"></telerik:GridNumericColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings></ClientSettings>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>

Hope that helps.


Regards,
Konstantin Dikov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Mayur
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or