SharePoint 2013 목록 항목 페이징
-
10-12-2019 - |
문제
목록 항목 페이징으로 웹 파트를 만들려고합니다. 이 링크를 따랐습니다 http : // www .directSharePoint.com / 2011 / 03 / 단계별 가이드 - 구현 - 구현 - Paging.html SharePoint 2010 서버에서는 좋지만 2013 년에는 작동하지 않습니다.
public SPListItemCollection GetTestItems(string pagingInfo)
{
SPWeb objWeb = SPContext.Current.Web;
SPListItemCollection collection;
SPQuery objQuery = new SPQuery();
objQuery.RowLimit = (uint)MaxItemsOnPage;
objQuery.Query = Camlex.Query().OrderBy(i => i[SPBuiltInFieldId.Created] as Camlex.Desc).ToString();
objQuery.ViewFields = Camlex.Query().ViewFields(i => i["Title"]);
if (!string.IsNullOrEmpty(pagingInfo))
{
SPListItemCollectionPosition position = new SPListItemCollectionPosition(pagingInfo);
objQuery.ListItemCollectionPosition = position;
}
collection = objWeb.Lists["testList"].GetItems(objQuery);
return collection;
}
.
PagingInfo 문자열이 null이 아닌 경우, "다음"을 눌러서 할 때 paginginfo="Paged= true & p_id= 3 & p_created= 20130502 % 2022 % 3A19 % 3A00", 쿼리 반환 컬렉션 0 항목.
페이징 정보 문자열에서 P_Created= 20130502 % 2022 % 3A19 % 3A00을 제거하고 쿼리에서 주문을 사용하지 마십시오. 그러나 작성된 필드로 정렬해야합니다.
나는 p_created 값을 와 같이 만든다.
spencode.urlencode (Convert.ToString (Collection [collection.count - 1] [ "생성"]));
아마도 SharePoint 2013에서 잘못된 DateTime을 형성하거나 PagingInfo 문자열 형식으로 무언가를 변경 했습니까?
해결책
i는 생성 된 필드 대신 ID로 항목 정렬을 해결했습니다.그래서 문제가 datetime 형식으로 생각하는 것 같아요, 나는 그것을 고치는 방법을 찾지 못했습니다.
제휴하지 않습니다 sharepoint.stackexchange