簡體   English   中英

SharePoint 2010中的富名單分頁

[英]Rich List Pagination in SharePoint 2010

我有一個SharePoint列表,其中包含我需要逐頁顯示的數據。 必須要求是能夠跳過頁面並顯示總頁數(即1,2,3 ... 15)。 SharePoint是否允許這樣做?

到目前為止我嘗試過:CAML:似乎不可能,因為CAML查詢需要上一頁中的元素來顯示下一個元素。

REST:使用/_vti_bin/listdata.svc和LINQ查詢:

//VS2010 creates classes for all list items when adding reference to listdata.svc
RootDataContext context = new RootDataContext(new Uri(Utils.ListServiceUrl)); 
context.Credentials = System.Net.CredentialCache.DefaultCredentials;

//this works like a charm, I am able to filter items by category and page them 
//(category is a single lookup)
var query = (DataServiceQuery<NewsItemsItem>)context.NewsItems.
            Where(i => i.CategoryId == 2).
            Skip(3).
            Take(2);

//however, if I need more advanced filtering (Tags is multilookup) I fail 
//(the code below won't work as this approach does not allow to make aggregation 
//queries inside other query)
var query = (DataServiceQuery<NewsItemsItem>)context.NewsItems.
            Where(i => i.Tags.Where(t => t.Id == 3).Count() > 0).
            Skip(3).
            Take(2);

如果你能給我任何建議,我將不勝感激。

http://msdn.microsoft.com/en-us/library/ff798478.aspx使用linq跳轉到sharepoint無法幫助你。 因為sharepoint沒有“跳過N值”的工具。

查看這篇文章。 如果您按列排序並希望在caml中使用此順序對此列表進行分頁,那么它們將非常有用。

http://blogs.msdn.com/b/dbadki/archive/2008/10/08/caml-query-execution-using-pagination-for-custom-columns.aspx

http://blogs.msdn.com/b/colbyafrica/archive/2009/02/19/learning-sharepoint-part-vi-list-pagination.aspx

無論如何,在sharepoint中的列表分頁是安靜可怕的(我想不僅對我來說)。 因為我只能像“上一個 - 下一個”而不是“1 2 3 4 5 ....”頁面一樣分頁

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM