I am using igTree with LoadOnDemand is set to true.
I have a WCF REST Service which giving me data to populate in igTree.
Please find the sample code..
$.ajax(
{
type: "GET",
url: "AssessmentProcWCFService.svc/GetAllEntities",
contentType: "application/json; charset=utf-8",
dataType: 'json',
data: '{}',
cache: false,
success: OnGetAllEntitiesSuccess,
error: OnGetAllEntitiesFailure
});
==================================================
function OnGetAllEntitiesSuccess(categoryList) {
$("#APTreeView").igTree({
animationDuration: 0,
dataSourceType: 'json',
dataSource: categoryList.d,
initialExpandDepth: false,
loadOnDemand: true,
dataSourceUrl: "AssessmentProcWCFService.svc/GetAllCategories?EntityID=primaryKey:id",
bindings: {
textKey: 'text',
valueKey: 'id',
primaryKey: 'id',
expanded: 'expanded',
childDataProperty: 'children'
}
=========================================================
Questions:-
1. How could I send the selected node ID to the Service when any node of the tree is expanding?
The way I am sending in the above example it is not working when I am retrieving it in the service “public List<APEntityTree> GetAllCategories()” like
“string entityID = HttpContext.Current.Request.QueryString["EntityID"];”
I am getting entity id as null.
2. How the tree get rendered when any node get expanded if LoadOnDemand is true?
Please help me on this I have spend lot of time in it.
Hi there,
You are able to do this but it is not supported out of the box. What you would need to do further is to subscribe to the nodePopulating event and change the dataSourceUrl at runtime to reflect the EntityID that you're requesting. The node populating event exposes for you the node currently being populated so you can extract its primary key from the event arguments.
Let me know if this helps!
how do i set the "dataSourceUrl" inside the
$(document).delegate(
"#APTreeView", "igtreenodepopulating", function (evt, ui) {
Please let me know the child node will get rendered automatically after expand?
Hi,
Can i have context menu on right mouse button click on the selected node?
If yes please provide me with some sample.
There isn't a context menu internally supported by the tree, however a custom implementation should work just fine!
Thank you for using the Infragistics forums!
Thanks for your reply can you please provide any sample or way to achieve right clcik context menu.
I've attached the sample with igTree and simple context menu.
Please let me know if this helps.
Regards,
Stanimir Todorov
Hi sandy_joggy,
If you need further assistance with this case do not hesitate to contact us.
Thank you.
Sincerely,
Georgi Sashev
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support
Hello Sandy,
I as looking at your post and tried to reproduce the behavior that you experience.
I encountered the same issue when load on demand is enabled.
As Konstantin supposed, the nodesByValue is not returning a node element to you because the node is still not loaded.
I am attaching a sample with two igTrees (the second with LoadOnDemand) to see the difference.
Once the node is loaded on the client, select and expandToNode methods works as expected.
Hope this helps
Hey again,
I thought of something. Could you make sure that nodesByValue is returning a node element to you. Check whether node.length > 0 && node.length === 1.
Thanks,
Konstantin
Can you provide me with a small sample that reproduces the issue. I can help you further if I have that.
already did that still no luck.
Hi there.
You need to pass the node element into those functions not the node object. No need to call nodeFromElement on it. It would work if you remove that line :)