Hey guys, I have an UltraWebTree that is not working as expected. It has 4 levels deep, and after the roor it starts with 2 leaves. One of them is never selected. After the user clicks on it, it will highlight for less than a sec, refresh the page and then highlight the previous leave, without firing the NodeSelectionChanged event.
I just don't have a clue, could somebody help me please?
HTML markup:
<ignav:UltraWebTree id="UltraWebTree1" runat="server" DisabledClass="" NodeEditClass="" TargetFrame="" TargetUrl="" OnNodeSelectionChanged="UltraWebTree1_NodeSelectionChanged" > <Levels> <ignav:Level Index="0" LevelCheckBoxes="False"></ignav:Level> <ignav:Level Index="1"></ignav:Level> <ignav:Level Index="2"></ignav:Level> <ignav:Level Index="3"></ignav:Level> </Levels> </ignav:UltraWebTree>
This is how I populate the WebTree
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PopulateTreeView(); } } public void PopulateTreeView() { DataTable facClassTable = FacClassBLL.getList(); DataTable catGroupTable = CatGroupBLL.getList(); DataTable basicCatTable = BasicCatBLL.getList(); DataTable facAnalysisCat = FacAnalysisCatBLL.getList(); DataSet dataSet = new DataSet("CatCodes"); facClassTable.TableName = CacheKeys.FacClassList.ToString(); catGroupTable.TableName = CacheKeys.CatGroupList.ToString(); basicCatTable.TableName = CacheKeys.BasicCatList.ToString(); facAnalysisCat.TableName = CacheKeys.FacAnalysisCatList.ToString(); dataSet.Tables.Add(facClassTable); dataSet.Tables.Add(catGroupTable); dataSet.Tables.Add(basicCatTable); dataSet.Tables.Add(facAnalysisCat); dataSet.Relations.Add("FacClass_CatGroup", dataSet.Tables[CacheKeys.FacClassList.ToString()].Columns["FacClassSeq"], dataSet.Tables[CacheKeys.CatGroupList.ToString()].Columns["FacClassSeq"]); dataSet.Relations.Add("CatGroup_BasicCat", dataSet.Tables[CacheKeys.CatGroupList.ToString()].Columns["CatGroupSeq"], dataSet.Tables[CacheKeys.BasicCatList.ToString()].Columns["CatGroupSeq"]); dataSet.Relations.Add("BasicCat_FacAnalysisCat", dataSet.Tables[CacheKeys.BasicCatList.ToString()].Columns["BasicCatSeq"], dataSet.Tables[CacheKeys.FacAnalysisCatList.ToString()].Columns["BasicCatSeq"]); UltraWebTree1.DataSource = dataSet; UltraWebTree1.Levels[0].LevelKeyField = "FacClassSeq"; UltraWebTree1.Levels[1].LevelKeyField = "CatGroupSeq"; UltraWebTree1.Levels[2].LevelKeyField = "BasicCatSeq"; UltraWebTree1.Levels[3].LevelKeyField = "FacAnalysisCatSeq"; UltraWebTree1.Levels[0].RelationName = "FacClass_CatGroup"; UltraWebTree1.Levels[1].RelationName = "CatGroup_BasicCat"; UltraWebTree1.Levels[2].RelationName = "BasicCat_FacAnalysisCat"; UltraWebTree1.Levels[0].ColumnName = "FacClassTitle"; UltraWebTree1.Levels[1].ColumnName = "CatGroupTitle"; UltraWebTree1.Levels[2].ColumnName = "BasicCatTitle"; UltraWebTree1.Levels[3].ColumnName = "FacAnalysisCatTitle"; UltraWebTree1.DataMember = CacheKeys.FacClassList.ToString(); UltraWebTree1.DataBind(); }
Any help would be greatly appreciated, thanks in advance !!!!
Ulises
Ulises,
I'm not really sure I understand what the problem is, but it sounds like when you click on one of the nodes, it's not getting selected properly. The first thing that comes to mind for me is, how are you assigning keys to the nodes? Is it possible that two nodes have the same key? Also are you augmenting the node structure in any way during the selection change event?
It's probably best if you work through this with our developer support department. Go to http://es.infragistics.com/gethelp for support options, note that email support is always free.
-Tony
Thanks for your response !!!
Tony Lombardo"] it sounds like when you click on one of the nodes, it's not getting selected properly
That's right, the UltraWebTree displays fine and some nodes will work just fine but some others will not get selected. They will highlight, but after the postback, the selected node will change to the previous selected node without firing the NodeSelectionChanged event.
Tony Lombardo"] how are you assigning keys to the nodes?
UltraWebTree1.Levels[0].LevelKeyField = "FacClassSeq"; UltraWebTree1.Levels[1].LevelKeyField = "CatGroupSeq"; UltraWebTree1.Levels[2].LevelKeyField = "BasicCatSeq"; UltraWebTree1.Levels[3].LevelKeyField = "FacAnalysisCatSeq";
Tony Lombardo"]Is it possible that two nodes have the same key?
This numbers are automatically generated by the database, they are unique, so No it is not possible
Tony Lombardo"]Also are you augmenting the node structure in any way during the selection change event?
Sometimes It doesn't even fire, but when it does no, I don't change the structure. The UltraWebTree is only populated the very first time the page is hit.
I don't know why I have a feeling it will take weeks before I hear back from the developer support department, we might remove this control from our solution, or is there something else we could try?
Thanks again!
Our support group usually resoponds to emails very quickly - in the 1-2 business day range. If it takes longer than a week, chances are that the email on one of the ends got blocked by something.
Either way, this behavior seems quite odd so I'd certainly recommend you follow through with our support team. You may also want to download the latest hotfix in the mean time to try it out.
I contacted the support group, they replied quickly by the way, and after we exchanged a couple of emails they mentioned the problem described above is actually a bug of the control and it will be fixed on the next release.
My work around??
I limited the length of the node text, so text like:Electronics and Communications Equipment Maintenance Facilitieswas replaced for Electronics and Communications Equipment...
I spent a lot of time on it, so I hope this helps someone else.
I've actually came across a similar issue with the tree. If you have a large tree that expands down till a scrollbar appears and you select different nodes without every scrolling. Everything works as it should. The second you scroll and select a node is where everything goers to hell.
Once you scroll the the OnNodeSelectionChanged never fires again. It keeps going to the last selected node no matter what you do. Scroll back up and try selecting again... Scroll down, it doesn't matter.
Appears the control breaks with scrolling and I haven't been able to figure out why. It makes no sense as I don't even see a server side event being thrown for the scroll. Is there some hidden client side scroll event I'm not seeing?
An yes every node has a unique Id...
I thought I had I fixed it. Then I read your post, selected a node, everything was fine, then scrolled down and it kept doing the same thing......
I didn't know how to replicate the behavior, but I agree with you mobrown1 , the scrolling seems to mess up the control.
I guess that when I was shortening the lenght of the text I was limiting the need to use the scroll bar.
I've found through experimentation that the order of the code will affect whether the event wireup occurs. When I specify the ClientSideEvents property at the end of the C# (i.e. server-side) code, the JavaScript (i.e. client-side) code works properly. When I specify the ClientSideEvents near the constructor in the C# code, the JavaScript does not fire.
I was investigating a differnet issue and came across a slightly better fix for the issue of scrollTop not being set properly.
This was my resolve...
In the ComponentsTreeView_BeforeNodeSelectionChange function on the client I had alreadt added the following
ele.value = tree.scrollTop;
Now in the class file in the Page_Load I added the following
{
// if the page is being loaded for the first time
// SOME CODE
else
// This sets the controls Scroll position and is actually sent to the client. This resolved my bug and I took out the window.setTimeout I was using before
}
If you have questions let me know
same here too, thks for sharing!
Paulo Pereira, Portugal
imwalker said: hooking the following code into the client side event AfterNodeSelectionChange fixed the problem for me: function UltraWebTree_AfterNodeSelectionChange(treeId, nodeId){var selectedNode = igtree_getNodeById(nodeId); selectedNode.setText(selectedNode.getText()); }
hooking the following code into the client side event AfterNodeSelectionChange fixed the problem for me:
function UltraWebTree_AfterNodeSelectionChange(treeId, nodeId){
var selectedNode = igtree_getNodeById(nodeId);
selectedNode.setText(selectedNode.getText());
This fixed my problem too !!
Thanks for sharing !!!!
Problem with that is that if the node you selected is below the intial scrollTop which is default of 0 then you have issues and the node is unselected plus the node is not in sight.
I also did the same code you have but on top I changed the ComponentsTreeView_Initialze Client side code to reset the scrollTop for that controls div so that it scrolls into view and stays selected as follows
Both the 'ctl00$NewTabTreeId' and 'ctl00_DemandLoad' are hidden fields on the page
var e = document.body.all(treeId);
var de = document.getElementById("ctl00_DemandLoad");// If Demand loading I pass along this value to server and back due to page refresh... if a demand load occur I change the value in another client script ComponentsTreeView_DemandLoad
tree.scrollTop = ele.value;
}, 300);
newNode = igtree_getNodeById(sId); // Dont think this is even required anymore but was in code before i did a fix for soimething else but i can't remeber
newNode = igtree_getNodeById(sId);
de.value="0";
var e = document.getElementById("ctl00_DemandLoad");