Posted By

diogoweb on 06/15/11


Tagged

sharepoint


Versions (?)

Customazing XsltListViewWebPart XSL with pagination


 / Published in: XSLT
 

  1. <WebPartPages:XsltListViewWebPart runat="server" Description="" PartOrder="0" Default="FALSE" HelpLink="" AllowRemove="True" IsVisible="True" AllowHide="True" UseSQLDataSourcePaging="True" ExportControlledProperties="False" IsIncludedFilter="" DataSourceID="" Title="Pages" ViewFlag="8" NoDefaultStyle="TRUE" AllowConnect="True" DisplayName="Pages" CacheXslStorage="False" FrameState="Normal" PageSize="-1" PartImageLarge="" AsyncRefresh="False" ExportMode="NonSensitiveData" Dir="Default" DetailLink="" ShowWithSampleData="False" ListId="27c97b8d-fdb8-4c29-9ae4-9f2ab1be38f4" ListName="{27C97B8D-FDB8-4C29-9AE4-9F2AB1BE38F4}" FrameType="None" PartImageSmall="" IsIncluded="True" SuppressWebPartChrome="False" AllowEdit="True" ViewGuid="" ChromeType="None" AutoRefresh="False" AutoRefreshInterval="60" AllowMinimize="True" WebId="00000000-0000-0000-0000-000000000000" ViewContentTypeId="0x" InitialAsyncDataFetch="False" GhostedXslLink="main.xsl" MissingAssembly="Cannot import this Web Part." HelpMode="Modeless" ID="g_5b9fdc05_4e2f_438a_a9c3_d08b3a379b94" ConnectionID="00000000-0000-0000-0000-000000000000" AllowZoneChange="True" ManualRefresh="False" __designer:customxsl="fldtypes_Ratings.xsl" __MarkupType="vsattributemarkup" __WebPartId="{5B9FDC05-4E2F-438A-A9C3-D08B3A379B94}" __AllowXSLTEditing="true" WebPart="true" Height="" Width=""><ParameterBindings>
  2. <ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
  3. <ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
  4. <ParameterBinding Name="dvt_firstrow" Location="Postback;Connection"/>
  5. <ParameterBinding Name="OpenMenuKeyAccessible" Location="Resource(wss,OpenMenuKeyAccessible)"/>
  6. <ParameterBinding Name="open_menu" Location="Resource(wss,open_menu)"/>
  7. <ParameterBinding Name="select_deselect_all" Location="Resource(wss,select_deselect_all)"/>
  8. <ParameterBinding Name="idPresEnabled" Location="Resource(wss,idPresEnabled)"/>
  9. <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)"/>
  10. <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(core,noXinviewofY_DEFAULT)"/>
  11. <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)"/>
  12. <ParameterBinding Name="MoreAnnouncements" Location="Resource(wss,moreItemsParen)"/>
  13. <ParameterBinding Name="dvt_startposition" Location="Postback" DefaultValue=""/>
  14. </ParameterBindings>
  15. <XmlDefinition>
  16. <View Name="{1282C8BA-2702-4C55-A29B-EE5D5A70966E}" MobileView="TRUE" Type="HTML" DisplayName="All Documents" Url="/Pages/Forms/AllItems.aspx" Level="1" BaseViewID="1" ContentTypeID="0x" ImageUrl="/_layouts/images/dlicon.png" TabularView="FALSE">
  17. <Query/>
  18. <ViewFields>
  19. <FieldRef Name="Title"/>
  20. <FieldRef Name="Created"/>
  21. <FieldRef Name="PublishingPageContent"/>
  22. </ViewFields>
  23. <RowLimit Paged="TRUE">5</RowLimit>
  24. <Toolbar Type="Standard"/>
  25. <ViewStyle ID="16"/>
  26. </View>
  27. </XmlDefinition>
  28. <DataFields>
  29. </DataFields>
  30. <xsl>
  31.  
  32.  
  33. <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
  34. version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
  35. xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
  36. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  37. xmlns:sharepoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"
  38. xmlns:o="urn:schemas-microsoft-com:office:office" ddwrt:ghost="show_all">
  39. <xsl:include href="/_layouts/xsl/main.xsl" />
  40. <xsl:include href="/_layouts/xsl/internal.xsl" />
  41. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
  42. <xsl:output method='html' indent='yes' />
  43.  
  44.  
  45. <xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp"
  46. xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer"
  47. xmlns:sharepoint="Microsoft.SharePoint.WebControls" xmlns:o="urn:schemas-microsoft-com:office:office"
  48. ddwrt:ghost="" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
  49. <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]" />
  50. <table cellpadding="10" cellspacing="0" border="1" style="padding:25px;">
  51. <tr>
  52. <td colspan='2'>
  53. <b style="font-size:25px;">Friend's List</b>
  54. </td>
  55. </tr>
  56. <xsl:for-each select="$Rows">
  57. <xsl:call-template name="RowView">
  58. </xsl:call-template>
  59. </xsl:for-each>
  60. <tr>
  61. <td colspan="2"><xsl:call-template name="pagingButtons" /></td>
  62. </tr>
  63. </table>
  64. </xsl:template>
  65.  
  66. <xsl:template name="RowView">
  67. <xsl:variable name="thisNode" select="." />
  68. <tr>
  69. <td align="center">
  70. <img style="height:100px;border:5px solid #888;">
  71. <xsl:attribute name="src">
  72. <xsl:value-of select="@Picture"></xsl:value-of>
  73. </xsl:attribute>
  74.  
  75. <xsl:attribute name="alt">
  76. <xsl:value-of select="@Title"></xsl:value-of>
  77. </xsl:attribute>
  78.  
  79. </img>
  80. </td>
  81. <td valign="top">
  82. <b>Name : </b>
  83. <xsl:value-of select="@Title"></xsl:value-of>
  84. <br></br>
  85. <b>Email : </b>
  86. <xsl:value-of select="@Email" disable-output-escaping="yes"></xsl:value-of>
  87. <br></br>
  88. <b>Address :</b>
  89. <br></br>
  90. <blockquote>
  91. <xsl:value-of select="@Address" disable-output-escaping="yes"></xsl:value-of>
  92. </blockquote>
  93. </td>
  94. </tr>
  95. </xsl:template>
  96.  
  97. <xsl:template name="pagingButtons">
  98. <xsl:choose>
  99. <xsl:when test="$XmlDefinition/List/@TemplateType = 106 and $XmlDefinition/@RecurrenceRowset='TRUE'">
  100. <xsl:if test="$dvt_nextpagedata or $dvt_prevpagedata">
  101. <xsl:call-template name="CalendarExpandedRecurrenceFooter"/>
  102. </xsl:if>
  103. </xsl:when>
  104. <xsl:otherwise>
  105. <xsl:if test="$XmlDefinition/RowLimit[@Paged='TRUE']">
  106. <xsl:call-template name="CommandFooter">
  107. <xsl:with-param name="FirstRow" select="$FirstRow" />
  108. <xsl:with-param name="LastRow" select="$LastRow" />
  109. <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
  110. </xsl:call-template>
  111. </xsl:if>
  112. </xsl:otherwise>
  113. </xsl:choose>
  114. </xsl:template>
  115. <xsl:template name="CommandFooter">
  116. <xsl:param name="FirstRow" select="1"/>
  117. <xsl:param name="LastRow" select="1"/>
  118. <xsl:param name="dvt_RowCount" select="1"/>
  119. <xsl:if test="$FirstRow &gt; 1 or $dvt_nextpagedata">
  120. <xsl:call-template name="Navigation">
  121. <xsl:with-param name="FirstRow" select="$FirstRow" />
  122. <xsl:with-param name="LastRow" select="$LastRow" />
  123. <xsl:with-param name="dvt_RowCount" select="$dvt_RowCount" />
  124. </xsl:call-template>
  125. </xsl:if>
  126. </xsl:template><xsl:template name="Navigation">
  127. <xsl:param name="FirstRow" select="1"/>
  128. <xsl:param name="LastRow" select="1"/>
  129. <xsl:param name="dvt_RowCount" select="1"/>
  130. <xsl:variable name="LastRowValue">
  131. <xsl:choose>
  132. <xsl:when test="$EntityName = '' or $LastRow &lt; $RowTotalCount">
  133. <xsl:value-of select="$LastRow"/>
  134. </xsl:when>
  135. <xsl:otherwise>
  136. <xsl:value-of select="$RowTotalCount"/>
  137. </xsl:otherwise>
  138. </xsl:choose>
  139. </xsl:variable>
  140. <xsl:variable name="NextRow">
  141. <xsl:value-of select="$LastRowValue + 1"/>
  142. </xsl:variable>
  143. <table id="bottomPagingCell{$WPQ}" style="font-size:25px;width:100%;padding:5px;" border="0">
  144. <tr>
  145. <td style="width:50%">
  146. <xsl:if test="$dvt_firstrow &gt; 1">
  147. <a>
  148. <xsl:choose>
  149. <xsl:when test="$dvt_RowCount = 0 and not($NoAJAX)">
  150. <xsl:attribute name="onclick">javascript:RefreshPageTo(event, "<xsl:value-of select="$PagePath"/>?<xsl:value-of select="$ShowWebPart"/>\u0026<xsl:value-of select='$FieldSortParam'/><xsl:value-of select='$SortQueryString'/>\u0026View=<xsl:value-of select="$View"/>");javascript:return false;</xsl:attribute>
  151. <xsl:attribute name="href">javascript:</xsl:attribute>
  152. <img src="/_layouts/{$LCID}/images/prev.gif" border="0" alt="{$Rows/@idRewind}" />
  153. <img src="/_layouts/{$LCID}/images/prev.gif" border="0" alt="{$Rows/@idRewind}" />
  154. </xsl:when>
  155. <xsl:otherwise>
  156. <xsl:variable name="RealRowLimit">
  157. <xsl:choose>
  158. <xsl:when test="$XmlDefinition/Query/GroupBy[@Collapse='TRUE']/@GroupLimit">
  159. <xsl:value-of select ="$XmlDefinition/Query/GroupBy[@Collapse='TRUE']/@GroupLimit"/>
  160. </xsl:when>
  161. <xsl:otherwise>
  162. <xsl:value-of select = "$XmlDefinition/RowLimit"/>
  163. </xsl:otherwise>
  164. </xsl:choose>
  165. </xsl:variable>
  166. <xsl:choose>
  167. <xsl:when test="not($NoAJAX)">
  168. <xsl:attribute name="onclick">javascript:RefreshPageTo(event, "<xsl:value-of select="$PagePath"/>?<xsl:value-of select="$dvt_prevpagedata"/><xsl:value-of select="$ShowWebPart"/>\u0026PageFirstRow=<xsl:value-of select="$FirstRow - $RealRowLimit"/>\u0026<xsl:value-of select='$FieldSortParam'/><xsl:value-of select='$SortQueryString'/>\u0026View=<xsl:value-of select="$View"/>");javascript:return false;</xsl:attribute>
  169. <xsl:attribute name="href">javascript:</xsl:attribute>
  170. </xsl:when>
  171. <xsl:otherwise>
  172. <xsl:attribute name="href">
  173. javascript: <xsl:call-template name="GenFireServerEvent">
  174. <xsl:with-param name="param" select="concat('dvt_firstrow={',$FirstRow - $XmlDefinition/RowLimit,'};dvt_startposition={',$dvt_prevpagedata,'}')"/>
  175. </xsl:call-template>
  176. </xsl:attribute>
  177. </xsl:otherwise>
  178. </xsl:choose>
  179. <img src="/_layouts/{$LCID}/images/prev.gif" border="0" alt="{$Rows/@idPrevious}" />Pre
  180. </xsl:otherwise>
  181. </xsl:choose>
  182. </a>
  183. </xsl:if>
  184. </td>
  185.  
  186. <td style="width:50%" align="right">
  187. <xsl:if test="$LastRowValue &lt; $dvt_RowCount or string-length($dvt_nextpagedata)!=0">
  188.  
  189. <a>
  190. <xsl:choose>
  191. <xsl:when test="not($NoAJAX)">
  192. <xsl:attribute name="onclick">javascript:RefreshPageTo(event, "<xsl:value-of select="$PagePath"/>?<xsl:value-of select="$dvt_nextpagedata"/><xsl:value-of select="$ShowWebPart"/>\u0026PageFirstRow=<xsl:value-of select="$NextRow"/>\u0026<xsl:value-of select='$FieldSortParam'/><xsl:value-of select='$SortQueryString'/>\u0026View=<xsl:value-of select="$View"/>");javascript:return false;</xsl:attribute>
  193. <xsl:attribute name="href">javascript:</xsl:attribute>
  194. </xsl:when>
  195. <xsl:otherwise>
  196. <xsl:attribute name="href">javascript: <xsl:call-template name="GenFireServerEvent">
  197. <xsl:with-param name="param" select="concat('dvt_firstrow={',$NextRow,'};dvt_startposition={',$dvt_nextpagedata,'}')"/>
  198. </xsl:call-template>
  199. </xsl:attribute>
  200. </xsl:otherwise>
  201. </xsl:choose>
  202. Next<img src="/_layouts/{$LCID}/images/next.gif" border="0" alt="{$Rows/@tb_nextpage}" />
  203. </a>
  204. </xsl:if>
  205. </td>
  206. </tr>
  207. </table>
  208.  
  209. <xsl:if test="not($GroupingRender)">
  210. <script>
  211. var topPagingCell = document.getElementById(&quot;topPagingCell<xsl:value-of select="$WPQ" />&quot;);
  212. var bottomPagingCell = document.getElementById(&quot;bottomPagingCell<xsl:value-of select="$WPQ" />&quot;);
  213. if (topPagingCell != null &amp;&amp; bottomPagingCell != null)
  214. {
  215. topPagingCell.innerHTML = bottomPagingCell.innerHTML;
  216. }
  217. </script>
  218. </xsl:if>
  219. </xsl:template>
  220. </xsl:stylesheet>
  221.  
  222.  
  223.  
  224.  
  225.  
  226. </xsl></WebPartPages:XsltListViewWebPart>

Report this snippet  

You need to login to post a comment.