如何将iNotes日历与自定义休息服务一起使用

时间:2014-01-17 05:30:02

标签: xpages xpages-extlib

我正在尝试使用自定义休息服务来填充iNotes日历控件。休息服务正在返回我需要的json,但无论我做什么,它都不会填充日历。看看extlib演示并没有真正解决这个问题。

已添加 - 我想使用非邮件应用程序,因此我可以在日历视图中使用必要的字段。但我想要一个自定义视图休息服务的主要原因是能够根据位置和部门进行过滤。

下面是我的xPage的代码,它有一个REST控件,CalendarStore控件和iNotes CalendarView控件。我还添加了休息服务返回的条目

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

<xe:restService id="restService1" pathInfo="inoteslegacyjson">
    <xe:this.service>
        <xe:viewJsonLegacyService viewName="Calendar">
            <xe:this.columns>
                <xe:restViewColumn columnName="DEPT" loaded="true"
                    name="dept">
                </xe:restViewColumn>
                <xe:restViewColumn columnName="startDate"
                    name="CalendarDateTim" loaded="true">
                </xe:restViewColumn>
                <xe:restViewColumn columnName="$147" loaded="true"
                    name="Subject">
                </xe:restViewColumn>
            </xe:this.columns>
        </xe:viewJsonLegacyService>
    </xe:this.service>
</xe:restService>
<xe:notesCalendarStore id="notesCalendarStore1"
    dojoType="xpagesext.CalendarStore">
<xe:this.dojoAttributes>
    <xp:dojoAttribute name="pathInfo" value="/inoteslegacyjson">
    </xp:dojoAttribute>
</xe:this.dojoAttributes></xe:notesCalendarStore>
<xe:calendarView id="calendarView1"
    storeComponentId="notesCalendarStore1" type="M">
</xe:calendarView></xp:view>

{
@timestamp: "20140122T180515"
@toplevelentries: "58"
    -viewentry: [
      -{
      @unid: "85257C210070DA5C85257C24006DD996"
      @noteid: "8FA"
      @position: "1"
      @read: "true"
      @siblings: "58"
-entrydata: [
-{
@columnnumber: "0"
@name: "dept"
-text: {
0: "Information Services"
}
}
-{
@columnnumber: "1"
@name: "CalendarDateTim"
-datetime: {
0: "20131129T180515"
}
}
-{
@columnnumber: "2"
@name: "Subject"
-text: {
0: "Linda Berry - PTO"
}
}
]
}

1 个答案:

答案 0 :(得分:3)

我同意蒂姆将你的问题分成两个单独的问题。我知道视图没有响应窗口大小的问题。因此,如果您在较小的窗口中打开日历并想要更改为全屏,则日历保持较小并添加一些空白区域。这是我对这个问题的简短解决方案:

为了让您的iNotesCalendar更具响应性,您可以使用dojo将函数连接到窗口,在xPage的底部添加此代码:

<script type="text/javascript">
    function resizeCalendar() {
        cview.resize();
    };

    dojo.addOnLoad( function() {
         dojo.connect(window, 'resize',resizeCalendar);
    });
</script>

当您的窗口调整大小时,此客户端脚本将调用日历对象的调整大小功能。 cviewjsId的{​​{1}}。

2)你的Json entrydata []似乎有点小。您的日历视图会对您的商店进行重新定位吗?在jsId._stores [0] .items下的DOM选项卡中为<xe:calendarView id="calendarView" jsId="cview">使用Firebug添加一个jsId,您应该找到当前查看月份的所有日历条目。如果没有项目显示您的json无效或缺少数据。如果你可以看到项目检查数据startDateTime,type,subject,unid ...如果有什么东西丢失或无效。