![]() |
Treeview focus() problem!
Hi,
We have a problem of treeview focus() when the page is loaded. Basically we are using it in webpart.(something like a frame) on pageload we tried with document.getElementById('Treeviewpanel').focus(), but it seems not working! Our custom tooltip will not display in proper position. as our business logic calculates the coordinates when click or focus is fired on treeview panel. Any clue to calculate the coodinates or focus on Treeview panel is appreciated. Thanks, Shridhar |
RE: Treeview focus() problem!
Hi,
not sure how much this will help, but it might be worth checking (using view source) the actual id of the treeview control. If you are planning to have more than one treeview control on the page (or more than one instance of that webpart on the page) then you should use something similar to the following: c# - tree = new TreeView(); tree.Attributes.Add("id", ReplaceTokens("oTree_WPQ_")); this will add a client side id related to the id of the webpart. When rendered, the ReplaceTokens function will seek "_WPQ_" and replace it with "WPQx" where x is the id of the webpart. You will also need to reflect this change in the javascript. Chances are you will have to pass in this id into the javascript function in this fashion: c# - output.Write(ReplaceTokens("<script>myfunction('oT ree_WPQ_');</script>")); Hope this helps - if it does, please post back to let me know. If you need me to look over some code, ping some back and I will endeavour to have a look. I am currently working on a treeview webpart and have solved several of these problems recently. Regards, James "Shridhar" wrote: > Hi, > > We have a problem of treeview focus() when the page is loaded. Basically we > are using it in webpart.(something like a frame) on pageload we tried with > document.getElementById('Treeviewpanel').focus(), but it seems not working! > Our custom tooltip will not display in proper position. as our business > logic calculates the coordinates when click or focus is fired on treeview > panel. > > Any clue to calculate the coodinates or focus on Treeview panel is > appreciated. > > Thanks, > Shridhar > |
RE: Treeview focus() problem!
Hi James
Thanks. Offcourse I am getting dynamic id(treeviewpanel/catalogtree) which is something like "MiddleLeftZone_g_ea3d89d3_93d1_434f_88cb_c10fe2f2 641b__ctl1_CatalogTree" but when I use thisid .focus() and if I add alert, this shows 'undefined.' I think the treeview.htc also has some dofocus(), cancelfocus()/changefocus() etc.(IE webcontrol tree) so it conflicts with our focus. If I do not use focus in my onhover function, first time it displays in wrong position. on click on the panel it displays on the proper position. again when focus lose, it display wrong position(if clicks someother places other than the panel).I have used for event.clientX and event.clientY for x and y coordinates. Note that this happens only when I set the height and width of the webpart. if the height and width is relative, the custom description displays fine, all the condition. Thanks, Shridhar. "JamesHead" wrote: > Hi, > > not sure how much this will help, but it might be worth checking (using view > source) the actual id of the treeview control. If you are planning to have > more than one treeview control on the page (or more than one instance of that > webpart on the page) then you should use something similar to the following: > > c# - > tree = new TreeView(); > tree.Attributes.Add("id", ReplaceTokens("oTree_WPQ_")); > > this will add a client side id related to the id of the webpart. When > rendered, the ReplaceTokens function will seek "_WPQ_" and replace it with > "WPQx" where x is the id of the webpart. You will also need to reflect this > change in the javascript. Chances are you will have to pass in this id into > the javascript function in this fashion: > > c# - > output.Write(ReplaceTokens("<script>myfunction('oT ree_WPQ_');</script>")); > > Hope this helps - if it does, please post back to let me know. If you need > me to look over some code, ping some back and I will endeavour to have a > look. I am currently working on a treeview webpart and have solved several of > these problems recently. > > Regards, > > James > > "Shridhar" wrote: > > > Hi, > > > > We have a problem of treeview focus() when the page is loaded. Basically we > > are using it in webpart.(something like a frame) on pageload we tried with > > document.getElementById('Treeviewpanel').focus(), but it seems not working! > > Our custom tooltip will not display in proper position. as our business > > logic calculates the coordinates when click or focus is fired on treeview > > panel. > > > > Any clue to calculate the coodinates or focus on Treeview panel is > > appreciated. > > > > Thanks, > > Shridhar > > |
RE: Treeview focus() problem!
I have used like
if((Wpheight != "")||(Wpwidth != "")) { tipX = event.clientX; tipY = event.clientY + offset; //141.. offeset I am calculating // tipX = event.offsetX; // tipY = event.offsetY; } else { //this part works perfectly all the conditions. tipX = window.event.x + 10 +document.body.scrollLeft ; tipY = window.event.y +document.body.scrollTop +10; } |
| All times are GMT. The time now is 02:34 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.