XPages:在dojo Ehancedgrid中使用jsonRest进行分页

时间:2015-11-12 13:46:28

标签: javascript dojo xpages

我在使用JSONRest的XPage应用程序中的Ehancedgrid中有一个分页插件的问题,在pageload我的网格显示5到10之间的几个数据,我的defaultPageSize是25,但是当我点击pager控件上的pageSizes时然后显示实际数量的数据。 以下是我的代码我不知道出了什么问题

<xe:restService id="demoRestService" pathInfo="gridData_View">
    <xe:this.service>
        <xe:customRestService contentType="application/json" requestVar="rowData" requestContentType="application/json">
    <xe:this.doGet><![CDATA[#{javascript:importPackage(com.ibm.office);
var inBox = new Mail(userProfile);  
inBox.convertToJSONString(sessionScope.inbox) }]]>
</xe:this.doGet>
        </xe:customRestService>
    </xe:this.service>
</xe:restService>   



<script>
    var jsonStore = new dojo.store.Cache(new dojo.store.JsonRest({target:"Mail.xsp/gridData_View",idProperty    : "id" }), dojo.store.Memory({idProperty : "id"}));
    var dataStore = dojo.data.ObjectStore({objectStore:jsonStore});
</script>   


<xe:djxDataGrid id="grid" store="dataStore" jsId="dataGrid" dojoType="dojox.grid.EnhancedGrid" query="{start: 0,  count: 25}" style="width: 70em;height: 80em;">
    <xe:this.dojoAttributes>
            <xp:dojoAttribute name="plugins">
                <xp:this.value><![CDATA[{selector: { cell: false, col: false},
                indirectSelection: {headerSelector:true, width:"20px", styles:"text-align: center;"},
                pagination: { description: true,position: "bottom", sizeSwitch: true, pageStepper: true, gotoButton: true,pageSizes: ["25", "50", "100","200", "All"],maxPageStep: 1, 
            defaultPageSize:"25" } }]]>
            </xp:this.value>
            </xp:dojoAttribute>

    </xe:this.dojoAttributes>
            <xe:this.onClick><![CDATA[
    var grid = dijit.byId('#{id:grid}');
    var items = grid.selection.getSelected();
    var v = []
            if(items.length){
                dojo.forEach(items, function(selectedItem){
                    if(selectedItem !== null){
                        var store = dataGrid.store;
                        var id=store.getValue(selectedItem, "Id")
                                v.push(id)
                    }
                });

            } 
    myRPC.setSelection(v)]]></xe:this.onClick>
    <xe:djxDataGridRow id="djxDataGridRow1">
        <xe:djxDataGridColumn id="djxDataGridColumn6" width="20em" label="Sender" field="Sender"></xe:djxDataGridColumn>
        <xe:djxDataGridColumn id="djxDataGridColumn7" width="50em" label="Subject" field="Subject"></xe:djxDataGridColumn>
        <xe:djxDataGridColumn id="djxDataGridColumn8" width="50em" label="ReceivedDate" field="ReceivedDate"></xe:djxDataGridColumn>
   </xe:djxDataGridRow>
</xe:djxDataGrid>

0 个答案:

没有答案