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

Filtering On Enterkey js error with AjaxManager and Masterpage

2 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten Bomholt
Top achievements
Rank 1
Morten Bomholt asked on 19 Feb 2009, 12:36 PM

I would like to enable filtering on the enter key, but i'm having problems with an example i downloaded from telerik and

would like to report a bug.

I downloaded 113486_radgridfiltering example which illustrates filtering on enter key.

The problem is that i use both masterpage and ajaxmanager and of course also an ajaxmanagerproxy.

I get a js error when i try to filter with enter key and for some reason the first item in the radgrid also is put in editmode.

Looks like the js needs a bit of tweaking. :)

I have altered the downloaded example 113486_radgridfiltering to illustrate the problems and packed it in a rar archive.

The example can be downloaded here:  http://80.166.206.186/Screendump/

Hope u have a solution to my problem, filtering without enter key is not an option for my customers. :)

2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetoslav
Telerik team
answered on 23 Feb 2009, 04:45 PM
Hello Morten Bomholt,

In order to solve the problem:

1. You have to download the latest dll from nightly builds.

2. Modify your client function as follows:

            var cancelFilterMenu=false;  
            var tableView=null;  
 
            function filterOnEnter(sender,e,gridId,col) {  
                if(e.keyCode==13) {  
                    cancelFilterMenu=true;  
 
                    //changes to the function  
                    ////////////////////////////////////////////////////////////  
                    //do not cache the table when having ajax on the page  
                    tableView=$find(gridId).get_masterTableView();  
                      
                    //cancel event bubbling  
                    e.cancelBubble = true;  
                    e.returnValue = false;  
                    ////////////////////////////////////////////////////////////  
                      
                   
                    var filter=Telerik.Web.UI.GridFilterFunction.Contains  
 
                    var query=sender.value;  
 
                    if(query.endsWith('*')&&query.startsWith('*')) {  
                        filter=Telerik.Web.UI.GridFilterFunction.Contains;  
                        query=query.substr(1,query.length-2);  
                    } else if(query.endsWith('*')) {  
                        filter=Telerik.Web.UI.GridFilterFunction.StartsWith;  
                        query=query.substr(0,query.length-1);  
                    }  
                    tableView.filter(col,query,1);  
                }  
            }  

Hope this helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Morten Bomholt
Top achievements
Rank 1
answered on 24 Feb 2009, 09:07 AM
Tsvetoslav, it worked like a charm. :)

Thx a mill.

Regards

Morten Bomholt
Tags
Grid
Asked by
Morten Bomholt
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Morten Bomholt
Top achievements
Rank 1
Share this question
or