Filter on Enter not working after upgrading to 2008.3.1312.35

10 posts, 1 answers
  1. mkasuboski
    mkasuboski avatar
    17 posts
    Member since:
    Jul 2008

    Posted 14 Jan 2009 Link to this post

    I just upgraded my Telerik.dll to 2008.3.1312.35 and my filter on enter seems to have quit working.

    I have this code in the code-behind for the ItemCreated event:
            If e.Item.ItemType = GridItemType.FilteringItem Then 
                Dim filterItem As GridFilteringItem = e.Item 
                For Each col As GridColumn In rgSelectCustNo.MasterTableView.RenderColumns 
                    If col.UniqueName = "ExpandColumn" Or col.UniqueName = "RowIndicator" Then 
                        Continue For 
                    Else 
                        Dim colName As String = col.UniqueName 
                        Dim txt As TextBox = CType(filterItem(colName).Controls(0), TextBox) 
                        If Not txt Is Nothing Then 
                            txt.Attributes.Add("onkeypress""filterOnEnter(this, event, '" & rgSelectCustNo.ClientID & "', '" & colName & "')"
                        End If 
                    End If 
                Next 
            End If 

    And this javascript in the HTML:
            var cancelFilterMenu = false
            var tableView = null
     
            function filterOnEnter(sender, e, gridId, col) { 
                if (e.keyCode == 13) { 
                    cancelFilterMenu = true
                    if (tableView == null) { 
                        tableView = $find(gridId).get_masterTableView(); 
                    } 
                    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, filter); 
                } 
            } 
     

    The application is still working on my development and production machine, but only because I have not upgraded the Telerik.dll yet. The web page with the above code has not been modified since deployment to both the development and production environments.

    Thanks!


  2. mkasuboski
    mkasuboski avatar
    17 posts
    Member since:
    Jul 2008

    Posted 15 Jan 2009 Link to this post

    I just wanted to push this post back to the top since it is impacting any future deployments we have for our websites.

    Thanks!
  3. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 16 Jan 2009 Link to this post

    Hello mkasuboski,

    The behavior you are experiencing is due to the introduction of Column's FilterTemplate functionality. Thus your custom code should be modified in order to function correctly with this grid feature. I have attached a sample page which demonstrates the necessary changes.

    Also please note that there was an issue with client-side filter function, which was addressed by our developers. That is why the archive contains a trial version of the latest internal build (you may open a formal support ticket for the dev version or check when it is available in latest internal build section of your account).

    We updated your Telerik points for drawing our attention to these details.

    Best regards,
    Rosen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. mkasuboski
    mkasuboski avatar
    17 posts
    Member since:
    Jul 2008

    Posted 16 Jan 2009 Link to this post

    Okay, I only saw one difference in your attached code sample and my current code sample, and I don't see how this will fix the issue.
    The difference is only 1 line in the client side code in the filterOnEnter function.

    Here is my line of code:
    tableView.filter(col, query, filter); 

    Here is your line of code from the attached sample:
    tableView.filter(col,query,1); 

    All you did was hard code a filter option, instead of letting the prior code in the function determine the filter option.  I really don't see how this will correct the issue I am having.

    In the rest of your email, are you telling me that there is a newer version (trial) of the DLL that WILL fix my issue, or that it addressed client side filtering issue and you really don't know if it will fix the issue?
    What version is this new DLL, and what code changes will I need to make when using this new DLL?





  5. Answer
    Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 16 Jan 2009 Link to this post

    Hi mkasuboski,

    I'm sorry about the confusion.

    The actual line that need to be changed is this:
    txt.Attributes("onkeydown") = "filterOnEnter(this, event, '" & RadGrid1.ClientID & "', '" & colName & "')" 
    This will override the onkeydown function which is added to the textbox control.

    As to the mentioned version of the dll (attached previously):
    It addresses the client-side filtering function issue which will throw a js error if a Telerik.Web.UI.GridFilterFunction enum value if passed instead of an GridFilterFunction's string representation.

    Best regards,
    Rosen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. mkasuboski
    mkasuboski avatar
    17 posts
    Member since:
    Jul 2008

    Posted 16 Jan 2009 Link to this post

    This DLL version, 2008.3.1316.35 and suggested code-behind change corrected the issue of 'Filter on Enter' for the RadGrid.

    Thanks!
  7. Kev
    Kev avatar
    1 posts
    Member since:
    Mar 2009

    Posted 09 Mar 2009 Link to this post

    Hi, i have implemented the fix recommended here but it only part fixed the problem...  It worked on the first page load the first time I  filteedr, but when i cleared the search and tried again, i just got the filter menu pop where ever my mouse pointer was.  I have got my grid inside a ascx control and this uses standard AJAX update panel to prevent the postback.  Any ideas?? Thanks Kev
  8. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 12 Mar 2009 Link to this post

    On the previous version, I did not implement any special code to apply the filter when enter was hit. After upgrading, no filter is applied when enter is hit. Do I need to implement some special code to make it work?

    /Henrik
  9. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 12 Mar 2009 Link to this post

    Hello Henrik,

    Can you please check whether the issue you depicted appears with the latest internal build available for download from your account? You can also migrate to the Q1 2009 official release of our controls which is expected to be announced later today.

    Best regards,
    Sebastian
    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.
  10. Henrik
    Henrik avatar
    40 posts
    Member since:
    Jan 2009

    Posted 24 Mar 2009 Link to this post

    Hi Sebastian,

    The bug is fixed in the Q1 2009 official release version.

    Best regards,

    Henrik
Back to Top