none
Support paging in custom xslt and apply it to Listview webpart

    Soru

  • Hi Gurus,

    I have a listview webpart. I want to apply a custom xslt to it. I am able to apply a custom xslt to the listview webpart, however I am not able to find a xslt code to support "paging" in the xslt for the webpart. Please bail me out.

    Thanks in Advance

    Regards,

    Bokes

    14 Eylül 2010 Salı 09:19

Tüm Yanıtlar

  • I'd imagine a good place to start would configuring the number of rows to display in the underlying view to correspond to your page size. Otherwise you're managing paging in two places if you have a lot of rows in your grid.
    Ch. - My Blog | SharePoint 2010 Application Development - My Book
    14 Eylül 2010 Salı 14:39
  • Hi Charlie,

    I have configured the underlying view to show 20 items at a time. But my custom xslt is applied only on the first 20 items, as I am unable to get the xslt code to support paging. can you provide me a xslt code to support paging using my xslt.

    Appreciate your response.

    Thanks,

    Bokes

    15 Eylül 2010 Çarşamba 11:09
  • I recently encountered this exact issue. I was using SharePoint Designer to help me create custom XSLT which I then brought back into my Visual Studio solution so that I could permanantly associate a certain type of rendering with a given list.

    You likely don't need any special additional XSL to make paging work, but, you might have a missing or mal-formed xsl:param that is reponsible for grabbing records that the paging xsl template would eventually need to have passed into it. In my scenario, the custom rendering was working, but, I could only see the first page of records even though I knew there were more.

    In the following code block, I'll paste the *bad* code that I had in my XSL file initially. The last xsl:param, "AllRows", is what is responsible for the paging (or, better stated, the AllRows param determines the records available for paging).. and it is mal-formed in this snippet 

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet 
    		xmlns:x="http://www.w3.org/2001/XMLSchema" 
    		xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" 
    		version="1.0" 
    		exclude-result-prefixes="xsl msxsl ddwrt" 
    		xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" 
    		xmlns:asp="http://schemas.microsoft.com/ASPNET/20" 
    		xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" 
    		xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    		xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
    		xmlns:SharePoint="Microsoft.SharePoint.WebControls" 
    		xmlns:ddwrt2="urn:frontpage:internal" 
    		xmlns:o="urn:schemas-microsoft-com:office:office">
      <xsl:include href="/_layouts/xsl/main.xsl"/>
      <xsl:include href="/_layouts/xsl/internal.xsl"/>
      <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[(position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>
    ... truncated out the meat of my xsl customizations ....
    </xsl:stylesheet>

    I think it has something to do with the WYSIWYG functionalities in SPD. Again, this is just a guess, but, I think because during development I had tried to custom design a list with only 2 or 3 items in it. Thus, the paging XSL code isn't shown properly in SharePoint Designer's code view since no paging was necessary in the design view. Instead, I had to put a bunch of bogus rows in my list, so that by the time I went into SharePoint Designer it would render the correct paging code.

    So, in the above XSL template, delete the xsl:param AllRows node, and replace it with this one instead:

    <xsl:param name="AllRows" select="/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]"/>




    • Yanıt Olarak Öneren deeshubby 15 Haziran 2012 Cuma 17:00
    • Düzenleyen deeshubby 15 Haziran 2012 Cuma 17:12 reorganize sentences
    15 Haziran 2012 Cuma 16:59