获取一定数量的记录并显示在表格中

时间:2016-12-20 06:28:42

标签: sapui5 sap-fiori

如何从数据库中获取记录。我有500条记录我想要在数据库中初始获取200条记录,并且在用户按下之后我想要获取另外200条记录...我已经完成了如下但是只得到了200条记录,如果我使用top = 200 ..     如果我没有使用top = 200 ..然后获取所有记录..

var url = "/sap/opu/odata/sap/ZODATA_CRUD_OPR_SRV/";
//Service Url
var oModel1 = new sap.ui.model.odata.ODataModel(url);
var oUrlParams = "$top=" + '200' + "&$skip=" +'0' ;

oModel1.read("/EmpDetails1Set", null,oUrlParams,true, function(oData){ //read method
oODataJSONModel.setData(oData); 
that.getView().setModel(oODataJSONModel,"emp");     
},
function(error) {

});

<Table id="table" width="auto"  growingScrollToLoad="false" growingThreshold="100" items="{emp>/results}" growing="true"> 

<columns>
    <Column id="nameColumn">
        <Text text="" id="nameColnTitle"/>
    </Column>
    <Column id="namolumn">
        <Text text="" id="nameCumnTitle"/>
    </Column>       
</columns>
    <items>
    <ColumnListItem type="Navigation"   press="onPress">
    <cells>
    <Text id="ob"   text="{emp>Name}"/> 
    <Text       text="{emp>Address}"/>  
    </cells>
    </ColumnListItem>
    </items>
    </Table>

1 个答案:

答案 0 :(得分:0)

设置<plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.19</version> <dependencies> <dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-surefire-provider</artifactId> <version>1.0.0-M3</version> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.0.0-M3</version> </dependency> </dependencies> </plugin> 非常重要,它将调用OData集合。我希望您已将items="{/EmpDetails1Set}"设置为应用程序的OData服务URL。 通过这种方法,您不需要将模型数据从控制器设置到视图。

/sap/opu/odata/sap/ZODATA_CRUD_OPR_SRV/
相关问题