I guess this was not added to the CSOM. Anyone had any luck implementing something that can tell when the mouse is hovering over a node? I need to trigger a javascript function when a user hovers on a node.
Hi.
I required the same functionality and was able to successfully wire up the event.
1. Copy the ig_webtree.js file from the scripts directory where you installed infragistics into your project folder. (located maybe in C:\Program Files\Infragistics\NetADVantageversionX\ASP.NET\Scripts)
2. Set the JavascriptFilename property on the tree to the file you've copied.
3.Modify the copied Javascript file.
- Look for the following functions within:
function igtree_mouseover(evnt,tn) which in my version was on line 1089. At the end of the function there is an if statement if(igtxt!=null && igtxt.length>0) { ... somewhere inside that if statement, write a call to a new function. e.g. MyMouseOverFunction(tn,eNode.id) and then create this function in your own javascript files.
then you've got your event!
If you also want the Mouse Out event. The next function in the ig_webtree should be called function igtree_mouseout(evnt,tn). look for the if statement near the end of the function like: if(src.hoverSet) { and put your function in there MyMouseOutFunction(tn,eNode.id)
hopefully this was helpful!
I started work moding their js file and so far I have added my function call in the place you suggested and see what's happening. I think I need to do something like the following in my function:
First I added :
this.NodeHover=events[25]; to
function igtree_events(events)
function MyMouseOverFunction(tn, id)
{
var tree=igtree_treeState[tn];
var node=igtree_getNodeById(id);
if(node == null || !node.getEnabled())
return;
var oEvent = igtree_fireEvent1(tree,tree.Events.NodeHover,node,ig_dataTransfer,evnt);
}
I have tree, and I've added the event to the event collection(NodeHover), I have the node retrieved by the id sent into my function. What I don't have is ig_dataTransefer and evnt. Am I on the right track? Any suggestions about the missing objects?
Thanks,
Patrick
I would sumbit a IR to infragistics at the following URL:
http://devcenter.infragistics.com/Protected/SubmitSupportIssue.aspx
I think they have 72 hours to get back to you if you don't have priority support... However if it is a bug, they have been prety good about letting me talk with developers to help get a work around or fix for the problem.
Good luck.
I would try and strip out every line of code, that you wrote, except your function call in the modified js file. Then write the function on your page or in the ascx.. I think you can write javascript in an ascx file... and put a simple alert in the funciton and see if it fires on hover.
I have created a brand new web application that is the same as my other web app and that is functioning correctly.... I have no idea what it is in the other project that is not allowing the JavascriptfileName to be changed.. Atleast I know that it is not a major bug in my control set.
bizarre. In the broken project, can you see the modified javascript file and its containing directory in the solution explorer?
Yes I implemented them the exact same way and one will work and the other doesn't. The one that doesn't work is my actual project which is great.
All I need to do is add a hovermenu but now I have been informed I can add one on the right click which you can implement a context menu with the clientside code example from their documentation. So in the end I guess it worked out for me.
Appreciate your attempt at helping me.
Your welcome. The popup menu on right click is nice. I have that working in the same project that I have the onNodeHover implemented in. I have been trying to think of a reason that the onnodehover 'hack' would work in one project but not the other and I am still comming up blank. At least you found a work around. o well, back to GUID's for me.
Nevermind I found a post that showed how to initialize the menu from the sever code behind and then create the client side function that gets the menuid for you if your context menu is in a user control.
Hey Patrick you seem pretty knowledgable of the CSOM. Is there any reason why the CSOM only allows you to grab infragistics controls on the client side if you have your script in the <Head> tag of the .aspx page? It doesn't seem scalable to me if you would like to give some client side functionality to your .ascx (user controls). This is bad for me considering my companies architecture is based on dynamic controls being loaded into one aspx page. Their architecture is based off of the MVC/MVP design pattern.
I have context menu's that could be used in the ascx but I'll end up having to break our architecture and place the context menu itself in the apsx side and just make sure to pass the click events back to our Controller.