ContextKey + OnItemOver

4 posts, 1 answers
  1. Vitalij
    Vitalij avatar
    39 posts
    Member since:
    Dec 2010

    Posted 30 Mar 2011 Link to this post

    Hi,
    I want to change autocomplete extender from ACT with RadComboBox ( because of loading on demand and virtual scrolling ). Loading and scrolling is working correctly. But I am populating data from WebServis and I need to send additional info to webservis ( like contextKey in autocompleteextender ) -  this value can be set from codebehind and I also need OnClientItemSelectedEvent ( when I hoover over item in combobox I want to show additional info about that item ).

    Another thing I dont understand is: in aspx page I set parameter ItemsPerRequest, but how can I get that value in webservis??
    In ace it is a parameter for web servis method - method signature ( string prefixText, int count, string contextkey ).

    Is there a way how to do this??

    Thanks in advance
  2. Vitalij
    Vitalij avatar
    39 posts
    Member since:
    Dec 2010

    Posted 30 Mar 2011 Link to this post

    So I added OnClientItemsRequesting event and in javascript I can add value to context. But there is still a problem how to pass value to that javascript function.

    To second problem: I added OnClientItemDataBound event, in javascript I have 
    var item = eventArgs.get_dataItem();
    But how can I append onMouseOver event to that item. 
    item.mouseover(function () { alert('test'); });
    is not working
  3. Vitalij
    Vitalij avatar
    39 posts
    Member since:
    Dec 2010

    Posted 31 Mar 2011 Link to this post

    I was able to add 'onitemhoover' event:

    First attempt:
    function OnClientItemDataBound(sender, eventArgs) {
     var item = eventArgs.get_dataItem();
     
    var identifier = 
    item.Value;
     
    var element = 
    eventArgs().get_item()._element;

     if 
    (element.onmouseover == null  {
       element.onmouseover = 
    (function () { alert(identifier); } );
    } }
    - but this way it works only for last items added into combobox. For example for the first combobox opening it works for all, after virtual scrolling it works only for second half of the items.

    Second attempt:
    function OnClientItemsRequested(sender, eventArgs) {
        
    var items = 
    sender.get_items();
        
    for ( var i in items._array )  {
          
     var item =  items._array[i];
           
    var 
    identifier =  item.get_value();
           
    var element 
    = item._element;

            
    if 
    (element.onmouseover == null {
                element.onmouseover 
    = ( function () { alert(identifier); } ); }
    }
    - but this way uniqidentifier is not changing and has constant value after each webservis call.

        
  4. Answer
    Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 05 Apr 2011 Link to this post

    Hello Vitalij,

    Regarding you first question about the ItemsPerRequest property, you could set this value in the WebService method or pass it as a context parameter.

    I've prepared an example where RadComboBox is populated through a WebService and RadToolTip Manger is used to show the text of the hovered item.

    I hope this would help you out.

    Kind regards,
    Dimitar Terziev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top