首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不片断化Jquery树

不片断化Jquery树
EN

Stack Overflow用户
提问于 2012-06-20 07:15:25
回答 1查看 723关注 0票数 0

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

请找到样本代码。

代码语言:javascript
复制
$.ajax(
            {
                type: "GET",
                url: "AssessmentProcWCFService.svc/GetAllEntities",
               contentType: "application/json; charset=utf-8",
                dataType: 'json',
                data: '{}',
                cache: false,
                success: OnGetAllEntitiesSuccess,
                error: OnGetAllEntitiesFailure
            });

==================================================

代码语言:javascript
复制
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'
                    }
                });
            }

=========================================================

问题:-

当树的任何节点正在扩展时,

  1. 如何将选定的节点ID发送到服务?我在上面的示例中发送的方式在服务“public List GetAllCategories()”中检索它时不起作用,比如“string entityID =entityID”,我得到实体id为null。如果LoadOnDemand为真,当任何节点被展开时,如何呈现树?

请帮我一下,我在这方面花了很多时间。

EN

Stack Overflow用户

发布于 2012-07-11 13:36:29

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

下面是解释的默认请求参数:http://www.infragistics.com/community/forums/t/65356.aspx

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

代码语言:javascript
复制
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);
                    }
                });
            }
票数 1
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11114587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档