DM
Dennis Morales
June 29, 2010 07:44 AM UTC
Just an update.
I am doing the refresh of treeview nodes by dynamically replacing the
list items Elements(UL/LI) and then calling the $create
$create(Syncfusion.MVC.Tools.TreeView,
{ "AllowEdit": false, "CollapseAll": false, "DragDrop": false, "ExpandAll": false, "HTML": "treemodel", "ShowLine": true, "Skin": "WindowsXP" },
null, null, $get("treeview"));
My problem with this is that it seems that calling the $create method appends a new double click item event which does the double click event twice. (the behavior of double click on item expands the item then closes it back again). How can I prevent the double click event from being assigned to the nodes if it already exists. Thanks
PK
Prem Kumar D
Syncfusion Team
June 29, 2010 08:58 AM UTC
Hi Dennis,
Thanks for using Syncfusion products
With regards to your query, we have a work around to get rid of this problem. You can call the below method 'Unwire_TreeViewEvents' before calling the $create(.......) on ajax post
function Unwire_TreeViewEvents() {
var treeViewObj = $find("treeViewId"); //'treeViewId' - id of the control
$(treeViewObj.get_Element()).unbind('click', treeViewObj._ClickEventHandler);
$(treeViewObj.get_Element()).unbind('mouseover', treeViewObj._MouseOverHandler);
$(treeViewObj.get_Element()).unbind('mouseout', treeViewObj._MouseOutHandler);
$(treeViewObj.get_Element()).unbind('dblclick', treeViewObj._inlineEdit);
if ($.browser.opera)
$(document).unbind('keypress', treeViewObj._pressF2Key);
else
$(document).unbind('keydown', treeViewObj._pressF2Key);
}
However this method will be available internally in our upcoming release.Let me know if you have any queries.
Best Regards,
Premkumar
DM
Dennis Morales
June 29, 2010 09:27 AM UTC
Thanks premkumar, your solution fixed the problem.
Another thing is that I am wondering if there is a method that would get all the collapsed items? That way I can collapse/expand all the previous items.
PK
Prem Kumar D
Syncfusion Team
June 29, 2010 02:35 PM UTC
Hi Dennis,
You can get the array of collapsed tree view items from the below code:
var collapsedItems = $("#MyTreeView").find('li[class~=collapse]');
where, 'MyTreeView' is the id of the treeview control
Let me know if you have any queries
Best Regards,
Premkumar
DM
Dennis Morales
June 30, 2010 01:55 AM UTC
Thanks
PK
Prem Kumar D
Syncfusion Team
June 30, 2010 03:48 AM UTC
Hi Dennis,
We are glad to hear that your problem has been resolved. Donot hesitate to get back to us for any further queries
Best Regards,
Premkumar
DM
Dennis Morales
July 5, 2010 07:36 AM UTC
I noticed that the click event was not firing after i called the $create method. Everything else is working fine except the click event of treeview
DM
Dennis Morales
July 5, 2010 07:45 AM UTC
I got it already.
I forgot to pass the ClientSideNodeClick event on the create method.
$create(Syncfusion.MVC.Tools.TreeView,
{ "AllowEdit": false, "CollapseAll": false, "DragDrop": false, "ExpandAll": false, "HTML": "treemodel", "ShowLine": true, "Skin": "WindowsXP" },
{ "ClientSideOnNodeClick": ReportList_ReportsTreeClick }, null, $get("treeview"));