LoadOnDemand and ShowMoreResults

2 posts, 0 answers
  1. co-logic
    co-logic avatar
    14 posts
    Member since:
    Jun 2006

    Posted 05 Feb 2009 Link to this post

    I implemented your LoadOnDemand demo project in my current project. It works fine for a small set of results. But due to the client side script "OnClientItemsRequesting" the demo fetches ALL results (search string is set empty!) when scrolling down to the next results. You can't see it in the demo, because there are less than 10 similar records searchable.

    In my project I use a client side variable to save the last typed text:

    <script type="text/javascript"
        var typedText = ""
        function OnClientItemsRequesting(sender, e) { 
            var context = e.get_context(); 
            if (!sender.get_appendItems()) typedText = e.get_text(); 
            context["FilterString"] = typedText; 

    Now I want to enable this code for multiple ComboBoxes. Is there an easy way to save the variable typedText with a single ComboBox?

    Or more simple: Is there a way to get the last user-typed-text? If I use e.get_text() even if get_appendItems is true, the first marked text is returned and not the user typed search text.
  2. Simon
    Simon avatar
    2281 posts

    Posted 09 Feb 2009 Link to this post

    Hello co-logic,

    You can disable the MarkFirstMatch functionality and use get_text regardless of the value returned by get_appendItems() method.

    Alternatively you could handle the OnKeyPressing event and store the entered text in a global variable. In case you use one event handler for all ComboBoxes, the global variable could be an object used as a hashtable where the keys would be the Client Ids of the ComboBoxes.

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top