在ICN中呈现搜索模板

时间:2017-01-24 23:27:29

标签: ibm-content-navigator

我尝试在ICN中呈现已保存的搜索(搜索模板),以下是用于调用服务插件的代码/通用类/

ecm.model.desktop
                                .getRepository(Desktop.defaultRepositoryId).retrieveSearchTemplate("{40B98008-EBB2-420A-8163-C74699EB678D}",null,null,function(searchTeamplate){
                                    debugger;
                                console.log("searchTeamplate" +searchTeamplate);
                                this.chkSearchTabContainer = dijit.byId("chkSearchTabContainer");
                                if(!this.chkSearchTabContainer){
                                    this.chkSearchTabContainer = new SearchTabContainer({

                                    },dojo.byId(domConstruct.create("div", {
                                        id : "checkSearchDIV"
                                    }, dojo.byId("myProgStackContainer"))))
                                }


                                this.chkSearchTabContainer.openTab({
                                    tabType : "search",
                                    repository : ecm.model.desktop.getRepository(Desktop.defaultRepositoryId),
                                    openNewTab : true,
                                    selected : true,
                                    closable : true,
                                    name:"try",
                                    // version: version,
                                    "searchTemplate" : searchTeamplate,
                                });
                                this.chkSearchTabContainer.startup();
                                this.chkSearchTabContainer.show();
                            });

console.log正在打印searchTeamplateecm.model.SearchTemplate [StoredSearch,{83443B0F-496B-46B0-B43C-5A23E494688D},{40B98008-EBB2-420A-8163-C74699EB678D}]

但没有渲染。相反,我不断收到错误消息 TypeError:name未定义。 下面是错误堆栈跟踪

cache["dojo/_base/loader"]/</slashName 

.cache["dojo/_base/loader"]/</dojo.require 
.cache["ecm/widget/layout/_TabContainerBase"]/</<._openTab 
.cache["ecm/widget/layout/_TabContainerBase"]/</<.openTab 
inherited 
.cache["ecm/widget/search/SearchTabContainer"]/</<.openTab
.init/<
.cache["ecm/model/Repository"]/</<._retrieveSearchTemplateCompleted 
.cache["ecm/model/Repository"]/</<.retrieveSearchTemplate/request< 
.cache["dojo/_base/lang"]/</lang.hitch/< 
.cache["ecm/model/Request"]/</Request<._onFinished 
.cache["ecm/model/Request"]/</Request<.send/this.xmlHttpRequest.onreadystatechange<
.cache["dojo/_base/lang"]/</lang.hitch/<

1 个答案:

答案 0 :(得分:1)

好的,这就是我做的事情

创建了一个SearchTab

this.chkSearchTabContainer = new SearchTab(
    {
        id : "chkSearchTabContainer",
        tabStrip : false,
        useMenu : false,
        useSlider : false,
        style : "height:800px"
});

获取搜索模板并设置

this.defaultRepository.retrieveSearchTemplates(
        function(searchTeamplateItems) {
            for (var k = 0; k < searchTeamplateItems.length; k++) {

                if (searchTeamplateItems[k].name =="my search template name") {

                        dijit.byId("chkSearchTabContainer").setSearchTemplate(searchTeamplateItems[k],false);
                        dijit.byId("checkContentPane").set("content",dijit.byId("chkSearchTabContainer"));
                        dijit.byId("checkContentPane").resize();
                        dijit.byId("dashBoardTC").startup();
                }
            }
        }, null);