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

ContextKey + OnItemOver

3 Answers 123 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Vladimir
Top achievements
Rank 1
Vladimir asked on 30 Mar 2011, 12:21 PM
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

3 Answers, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 30 Mar 2011, 12:51 PM
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
0
Vladimir
Top achievements
Rank 1
answered on 31 Mar 2011, 06:27 AM
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.

    
0
Accepted
Dimitar Terziev
Telerik team
answered on 05 Apr 2011, 03:28 PM
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
Tags
ComboBox
Asked by
Vladimir
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or