Jquery ui 基础设施Jquery树

Jquery ui 基础设施Jquery树,jquery-ui,infragistics,Jquery Ui,Infragistics,当LoadOnDemand设置为true时,我需要您在使用igTree方面提供一些帮助。 我有一个WCF REST服务,它为我提供数据来填充igTree 请查找示例代码 $.ajax( { type: "GET", url: "AssessmentProcWCFService.svc/GetAllEntities", contentType: "application/json;

当LoadOnDemand设置为true时,我需要您在使用igTree方面提供一些帮助。 我有一个WCF REST服务,它为我提供数据来填充igTree

请查找示例代码

$.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'
                    }
                });
            }
=========================================================

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'
                    }
                });
            }
问题:-

  • 当树的任何节点正在扩展时,如何将所选节点ID发送到服务? 在上面的示例中,当我在服务“public List GetAllCategories()”中检索它时,它的发送方式不起作用 字符串entityID=HttpContext.Current.Request.QueryString[“entityID”] 我得到的实体id为null

  • 如果LoadOnDemand为true,当任何节点展开时,如何渲染树


  • 请在这方面帮助我,我在这方面花了很多时间。

    基本上,您可以在向服务提出的请求中对任何您喜欢的内容进行编码:

    下面解释了默认请求参数:

    下面是如何添加请求参数:

    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'
                        },
                        nodePopulating: function (event, ui) {
                            var node = '&SelectedNodeID=' + $("#APTreeView").igTree('selectedNode').element.attr('data-value'),
                                myNewUrl = 'AssessmentProcWCFService.svc/GetAllCategories?EntityID=primaryKey:id' + node;
                            $('#myTree').igTree('option', 'dataSourceUrl', myNewUrl);
                        }
                    });
                }