I am using ManualSmartCallbacks and would like to set the DataPath client-side in the DemandLoad event, but there doesn't seem to be an Method to do this.
I need to do this because DataPath is the only field that seems to stay around when populating a tree view the DemandLoad server-side event. I'm setting data to the tag, but when that node is expanded the tag is not passed to the server. In reading other posts, I noted that DataPath is the only field that is persisted throughout, so in my server-side code I set the DataPath property also. I would like to be able to add additional client-side info and pass it up, but since I can't set DataPath, I seem to be restricted.
I am using 2007-3, so maybe there's an appropriate method in 2008-3.
Suggestions?
Thanks!
Yes, this approach was just a workaround in this specific case, since there was not setDataPath client-side methods in the public API, so it is not guaranteed that it would work in all cases.
Still, I am glad that you managed to find another solution and especially that you shared it in our public forums - I am sure many other people will find it useful as well.
Interestingly this DOES NOT WORK when DemandLoad="Manual"!
Without changing anything in my code except the DemandLoad parameter, the e.node.DataPath on the server-side was "".
Very strange, but I coded around it by setting the DataPath on the server-side while building the nodes initially.
Thank you! That resolved my issue.
Hello,
Yes, I see. This is a good question, by the way. So yes, you are correct, in the public CSOM unfortunately there is no public setDataPath method. Point taken, we might add this in the future. We do have getDataPath though, and I went through the source code to check it out and here is the source:
this.getDataPath = function() { return this.element.getAttribute("igPath"); }
Based on that, I decided that changing the igPath attribute in the DemandLoad client-side event might work, and voila, it indeed worked (at least in my case). Here is the client-side code that changes DataPath and changes are persisted to the server. Hope this works for you.
function Load(menuId, itemId) { var node = igtree_getNodeById(itemId); node.Element.setAttribute("igPath", "testValue") }
I guess I did not make myself clear.
The server creates the top level node and it contains a Tag. When the node is expanded, the server side code creates child nodes which contain Tags. However, when one of these nodes is expanded the Tag is not passed to the server. I can trap the client-side DemandLoad and I see the tag is in the node and it contains the tag (i.e., igtree_getNodeById(itemId).getTag()). However, the node on the server side looks like this:
?e.Node{Infragistics.WebUI.UltraWebNavigator.Node} CheckBox: NotSet {2} Checked: False CssClass: Nothing DataBound: False DataItem: Nothing DataKey: Nothing DataPath: "127:2<2>dir<2>8<1>" Enabled: True Expanded: False FirstNode: Nothing Hidden: False HiliteClass: "" HoverClass: "" Images: {Infragistics.WebUI.UltraWebNavigator.NodeImageUrls} ImageUrl: "" Index: 0 IslandClass: "" Level: 0 LoadOnDemand: False Margin: {Infragistics.WebUI.Shared.Margin} NextNode: Nothing NextVisible: Nothing Nodes: {Infragistics.WebUI.UltraWebNavigator.Nodes} Padding: {Infragistics.WebUI.Shared.Padding} Parent: Nothing PrevNode: Nothing PrevVisible: Nothing Selected: {"Object reference not set to an instance of an object."} SelectedImageUrl: "" ShowExpand: False Style: {Infragistics.WebUI.Shared.Style} Styles: {Infragistics.WebUI.Shared.Style} Tag: Nothing TagString: Nothing TargetFrame: Nothing TargetUrl: Nothing Text: Nothing Title: Nothing ToolTip: Nothing
Note that the DataPath contains information where nothing else does! This, along with the Tag and everything else, is set on the server side in the initial DemandLoad. My logic on the Server-side checks to see if e.node.Tag IS NOTHING, and uses the DataPath instead. This works fine, but I want to pass additional client-side status information to the server, thus I want to setDataPath.
Just for grins I added a igtree_getNodeById(itemId).setTag("xxx") in the client-side DemandLoad, but I did not see the xxx on the server-side.
Hope this clarifies my desire to setDataPath.