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

[Solved] How to set focus to the textbox in the filter control?

1 Answer 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
John Post
Top achievements
Rank 1
John Post asked on 06 Feb 2012, 06:03 PM

We would like to minimize the number of clicks a customer has to do.  Is there a way to set the focus to the first textbox in the filter popup when the filter icon is clicked?

This works but only for the first filter I select…

 

The problem would appear to be that the filter popups are dynamically generated so after the first, I’m not grabbing the right input:text.

 

 

 

 

 

columns.Bound(o => o.MinTemp).HeaderHtmlAttributes(new { @class = "oneClick" });
columns.Bound(o => o.MaxTemp).HeaderHtmlAttributes(new { @class = "oneClick" });
columns.Bound(o => o.Status).HeaderHtmlAttributes(new { @class = "oneClick" });
 
 
function onDataBound(e) {$(".oneClick .t-filter").click(function () {
 
 setTimeout(function () {
 
 $(".t-filter-operator").parent().find("input:text").first().focus();
 
 });
 
 });
 
 }

 

 

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 07 Feb 2012, 02:28 PM
Hi John,

Basically you can use the OnLoad event and the following handler. On my side everything works fine, does this fits your needs?
function onLoad() {
           $(this).find("th .t-grid-filter").click(function () {
               setTimeout(function () {
                   $('.t-filter-options').find('input:first').focus();
               }, 10);
           });
       }


Regards,
Petur Subev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Grid
Asked by
John Post
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or