0

LoadOnDemandがtrueに設定されている場合にigTreeを使用するには、いくつかの助けが必要です。igTreeに入力するデータを提供するWCFRESTサービスがあります。

サンプルコードを見つけてください。

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

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

質問:-

  1. ツリーのいずれかのノードが拡張しているときに、選択したノードIDをサービスに送信するにはどうすればよいですか?上記の例で送信している方法は、「string entityID = HttpContext.Current.Request.QueryString ["EntityID"];」のようなサービス「publicListGetAllCategories()」で取得しているときに機能しません。エンティティIDをnullとして取得しています。

  2. LoadOnDemandがtrueの場合、ノードが展開されたときにツリーはどのようにレンダリングされますか?

私はそれに多くの時間を費やしてきたこれについて私を助けてください。

4

1 に答える 1

1

基本的に、サービスに対して行われたリクエストで好きなものをエンコードできます。

説明されているデフォルトのリクエストパラメータは次のとおりです:http://www.infragistics.com/community/forums/t/65356.aspx

そして、リクエストパラメータを追加する方法は次のとおりです。

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);
                    }
                });
            }
于 2012-07-11T13:36:29.697 に答える