SBT javascript library

2019-08-29 02:43发布

the tutorial from IBM connections playground is not working for me https://greenhouse.lotus.com/sbt/SBTPlayground.nsf/JavaScriptSnippets.xsp#snippet=Social_ActivityStreams_Controls_Simple_Stream_All_Extensions

this works

require(["sbt/dom", "sbt/config", "sbt/connections/controls/astream/ActivityStreamWrapper"], function(dom, config, ActivityStreamWrapper) {
var activityStreamWrapper = new ActivityStreamWrapper({
    feedUrl: "/basic/rest/activitystreams/@public/@all/@all?rollup=true"
});

dom.byId("activityStreamDiv").appendChild(activityStreamWrapper.domNode);
activityStreamWrapper.startup();
});

efter adding the extension property in configuration, it stops working, nothing displays and no script error can be seen from developer tool,

require(["sbt/dom", "sbt/config", "sbt/connections/controls/astream/ActivityStreamWrapper"], function(dom, config, ActivityStreamWrapper) {
var activityStreamWrapper = new ActivityStreamWrapper({
    feedUrl: "/basic/rest/activitystreams/@public/@all/@all?rollup=true",
    extensions: {
        refreshButton: true
    }
});

dom.byId("activityStreamDiv").appendChild(activityStreamWrapper.domNode);
activityStreamWrapper.startup();
});

I am using Xpages to render the activity stream, the component in use to render all the JS and CSS files is named xe:sbtClient, xpages is using dojo 1.8.6, the rendered sbt js file is dojo 1.4.3. don't know if that is the problem. Here is the complete soucre code in my applicatoin.

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xe="http://www.ibm.com/xsp/coreex" dojoParseOnLoad="true"
xmlns:xc="http://www.ibm.com/xsp/custom">

<xe:sbtClient id="sbtClient1" loadDojo="true" loadCSS="true">
</xe:sbtClient>
<div id="activityStreamDiv" style="height:100%;"></div>

<xp:scriptBlock id="scriptBlock1">
    <xp:this.value><![CDATA[
require(["sbt/dom", "sbt/config", "sbt/connections/controls/astream /ActivityStreamWrapper"], function(dom, config, ActivityStreamWrapper) {
var activityStreamWrapper = new ActivityStreamWrapper({
    feedUrl: "/basic/rest/activitystreams/@public/@all/@all?rollup=true",
    extensions: {
        refreshButton: true
    } 
});
dom.byId("activityStreamDiv").appendChild(activityStreamWrapper.domNode);
activityStreamWrapper.startup();
});]]></xp:this.value>
</xp:scriptBlock>


</xp:view>

2条回答
叛逆
2楼-- · 2019-08-29 03:08

So the only difference between the two is the extensions property? There was an issue with extensions in an older version of the toolkit, I think updating to the latest version will solve your issue.

If you have the latest version already then I'll need more information on this problem. I have tried what you suggested in the playground and it works there (select dojo1.8.6 in the JavaScript libraries dropdown)

查看更多
我命由我不由天
3楼-- · 2019-08-29 03:31

I have updated the SDK, all the extensions properties can be seen extensions: {    commenting: true,    saving: true,    refreshButton: true,    deleteButton: true }, refresh works, but saving, commenting, delete do not work

error from commenting, it asks me to log in again enter image description here

error from delete, notauthorized even my identity in connections is global administrator enter image description here

error from save enter image description here

查看更多
登录 后发表回答