Domanda

Ho una lista di annunci e invece di visualizzare tutti gli annunci allo stesso tempo, ci può essere un bel po ', voglio scorrere uno per uno.

Al di fuori di SharePoint ci sono un bel alcuni metodi che userei per raggiungere questo obiettivo. Vorrei utilizzare jQuery, se possibile. Ho usato jQuery sul sito, ma vorrei usare una giostra e per questo la lista di annunci non può essere in una tabella.

Così, ho bisogno di uno di 3 cose.

a) Essere in grado di output dei dati, possibilmente ad un contenuto Web Part Editor, via XSL? Questo eliminerà la struttura della tabella e sostituirlo con una lista non ordinata. Io non sono che caldo su XSL e avrebbe bisogno di una spinta nella direzione giusta su come raggiungere questo obiettivo.

b) Trovare una soluzione jQuery che può lavorare con la struttura della tabella della lista annunci.

c) qualche altra soluzione che non ho pensato.

Tutte le idee ragazzi?

EDIT:. Ho cercato di imboccare la strada XSL con una Web Part Data Form

ho usato un'altra DFWP per un modello e ha cambiato quello che penso avevo bisogno di cambiare. Fa questo aspetto in ogni caso vicino a che cosa mi serve? (Nota sto ottenendo il seguente errore:)

Impossibile visualizzare questa web part. Per risolvere il problema, aprire questo pagina Web in uno SharePoint di Windows Servizi-compatibile editor HTML come come Microsoft Office SharePoint Progettista. Se il problema persiste, contattare l'amministratore del server Web.

Codice

<WebPartPages:DataFormWebPart runat="server" SuppressWebPartChrome="False" Description="" PartImageSmall="" DataSourceID="" MissingAssembly="Cannot import 

this Web Part." FrameType="TitleBarOnly" ConnectionID="00000000-0000-0000-0000-000000000000" DetailLink="" ExportControlledProperties="True" IsVisible="True" 

AllowRemove="True" AllowEdit="True" ID="g_999db424_8180_48da_a7c7_7457a07205f9" Dir="Default" FrameState="Normal" ViewContentTypeId="" AllowConnect="True" 

PageSize="-1" AllowMinimize="True" IsIncludedFilter="" ShowWithSampleData="False" ChromeType="TitleOnly" HelpMode="Modeless" ExportMode="All" ViewFlag="0" 

Title="Courses I am attending" HelpLink="" AllowHide="True" AllowZoneChange="True" PartOrder="1" UseSQLDataSourcePaging="True" PartImageLarge="" 

IsIncluded="True" NoDefaultStyle="TRUE" __MarkupType="vsattributemarkup" __WebPartId="{999DB424-8180-48DA-A7C7-7457A07205F9}" __AllowXSLTEditing="true" 

WebPart="true" Height="" Width=""><DataSources>
<SharePoint:AggregateDataSource runat="server" IsSynchronous="" SeparateRoot="true" RootName="" RowsName="" 

ID="Announcements"><Sources><SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;/View&gt;" UpdateCommand="" 

InsertCommand="" DeleteCommand="" UseInternalName="True"><SelectParameters>
<asp:Parameter DefaultValue="{A6930BA9-B6E2-4D1D-A3FE-5379CE9F01E5}" Name="ListID"></asp:Parameter>
                </SelectParameters>
<UpdateParameters>
<asp:Parameter DefaultValue="{A6930BA9-B6E2-4D1D-A3FE-5379CE9F01E5}" Name="ListID"></asp:Parameter>
                </UpdateParameters>
<InsertParameters>
<asp:Parameter DefaultValue="{A6930BA9-B6E2-4D1D-A3FE-5379CE9F01E5}" Name="ListID"></asp:Parameter>
                </InsertParameters>
<DeleteParameters>
<asp:Parameter DefaultValue="{A6930BA9-B6E2-4D1D-A3FE-5379CE9F01E5}" Name="ListID"></asp:Parameter>
                </DeleteParameters>
</SharePoint:SPDataSource><SharePoint:SPDataSource runat="server" DataSourceMode="List" SelectCommand="&lt;View&gt;&lt;/View&gt;" UpdateCommand="" 

InsertCommand="" DeleteCommand="" UseInternalName="True"><SelectParameters>
<asp:Parameter DefaultValue="{DEEE6EF9-4CCF-408B-A90F-89AD21FB0FD1}" Name="ListID"></asp:Parameter>
                </SelectParameters>
<UpdateParameters>
<asp:Parameter DefaultValue="{DEEE6EF9-4CCF-408B-A90F-89AD21FB0FD1}" Name="ListID"></asp:Parameter>
                </UpdateParameters>
<InsertParameters>
<asp:Parameter DefaultValue="{DEEE6EF9-4CCF-408B-A90F-89AD21FB0FD1}" Name="ListID"></asp:Parameter>
                </InsertParameters>
<DeleteParameters>
<asp:Parameter DefaultValue="{DEEE6EF9-4CCF-408B-A90F-89AD21FB0FD1}" Name="ListID"></asp:Parameter>
                </DeleteParameters>
</SharePoint:SPDataSource>
</Sources><Aggregate><concat name="data source"><datasource name="Announcements" id="0" Type="SPList"/></concat></Aggregate>
</SharePoint:AggregateDataSource>
</DataSources>
<ParameterBindings>
                <ParameterBinding Name="dvt_apos" Location="Postback;Connection"/>
                <ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>
                <ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/>
                <ParameterBinding Name="dvt_adhocmode" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_fieldsort" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_filterfield" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_sortdir" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_sortfield" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_sorttype" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_filterfields" Location="Postback;Connection"/>
                <ParameterBinding Name="dvt_partguid" Location="Postback;Connection"/>
            </ParameterBindings>
<DataFields>

</DataFields>
<Xsl>

<xsl:stylesheet xmlns:xs="http://www.w3.org/2001/XMLSchema" 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">
    <xsl:output method="html" indent="no"/>
    <xsl:param name="dvt_adhocmode">sort</xsl:param>
    <xsl:decimal-format NaN=""/>

    <xsl:param name="dvt_apos">'</xsl:param>
    <xsl:param name="UserID" />
    <xsl:param name="dvt_fieldsort" />
    <xsl:param name="dvt_filterfield" />
    <xsl:param name="dvt_sortdir">ascending</xsl:param>
    <xsl:param name="dvt_sortfield" />
    <xsl:param name="dvt_sorttype">text</xsl:param>
    <xsl:param name="dvt_filterfields" />
    <xsl:param name="dvt_partguid" />
    <xsl:variable name="dvt_1_automode">0</xsl:variable>

    <xsl:template match="/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:x="http://www.w3.org/2001/XMLSchema" 

xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" 

xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls">
        <xsl:call-template name="dvt_1"/>
    </xsl:template>

    <xsl:template name="dvt_1">
        <xsl:variable name="dvt_StyleName">Table</xsl:variable>
        <xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
        <xsl:variable name="dvt_RowCount" select="count($Rows)" />
        <xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" />
        <xsl:choose>
            <xsl:when test="$dvt_IsEmpty">
                <xsl:call-template name="dvt_1.empty" />
            </xsl:when>
            <xsl:otherwise><ul id="announcementList" border="0" width="100%" cellpadding="2" cellspacing="0">
                <li>
                <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" 

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
                    <xsl:with-param name="fieldname">@Title</xsl:with-param>
                    <xsl:with-param name="fieldtitle">Title</xsl:with-param>
                    <xsl:with-param name="displayname">Title</xsl:with-param>
                    <xsl:with-param name="sortable">1</xsl:with-param>
                    <xsl:with-param name="fieldtype">x:string</xsl:with-param>
                </xsl:call-template>
                </li>
                <li>
                <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" 

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
                    <xsl:with-param name="fieldname">@Created</xsl:with-param>
                    <xsl:with-param name="fieldtitle">Created By</xsl:with-param>
                    <xsl:with-param name="displayname">Created By</xsl:with-param>
                    <xsl:with-param name="sortable">1</xsl:with-param>
                    <xsl:with-param name="fieldtype">x:string</xsl:with-param>
                </xsl:call-template>
                </li>
                <li>
                <xsl:call-template name="dvt.headerfield" ddwrt:atomic="1" 

xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
                    <xsl:with-param name="fieldname">@Body</xsl:with-param>
                    <xsl:with-param name="fieldtitle">Body</xsl:with-param>
                    <xsl:with-param name="displayname">Body</xsl:with-param>
                    <xsl:with-param name="sortable">1</xsl:with-param>
                    <xsl:with-param name="fieldtype">x:string</xsl:with-param>
                </xsl:call-template>
                </li>
            </tr>
            <xsl:call-template name="dvt_1.body">
                <xsl:with-param name="Rows" select="$Rows"/>
            </xsl:call-template>
        </ul></xsl:otherwise>
        </xsl:choose>

    </xsl:template>


</xsl:stylesheet>   </Xsl>
</WebPartPages:DataFormWebPart>
È stato utile?

Soluzione 2

Ok ho fatto ricorso a una soluzione jQuery che posso ottenere la mia testa intorno ad esso più facile che qualsiasi cosa SharePoint getta su di me!

Come tutte le liste hanno la ms-summarycustombody classe I è stato in grado di ottenere la seguente per convertire il table a ul

var div = $("<div id='viewport' class='viewport'></div>");
var list = $("<ul id='announcementList'></ul>");
var listitem = null;
var p = null;
$('.ms-summarycustombody').each(function(i) {
    $(this).find("tr").each(function(i) {
        if (i % 3 == 0) {
            listitem = $("<li/>");
            list.append(listitem);
        }
        p = $("<p/>");
        $(this).find("td").each(function(i) {
            p.append("<span>" + $(this).html() + "</span>");
             });
                 listitem.append(p);
     });
     div.append(list);
     $(this).replaceWith(div);
});

Quindi, utilizzando jCarouselLite sono stato in grado di scorrere tra gli elementi.

$('.viewport').jCarouselLite({
    auto:5000,
    speed:1000
});

Altri suggerimenti

Vi suggerisco di controllare fuori SPServices. Si tratta di una "libreria jQuery che astrae Web Services di SharePoint e li rende più facile da usare".

http://spservices.codeplex.com/

Un'altra opzione da considerare è quello di costruire qualcosa usando l'oggetto client modello e JavaScript ... Ops, non si sta utilizzando SP2007.

Se la mia lettura della tua domanda è corretta, si dispone già di una giostra JavaScript che richiede una lista non ordinata con cui lavorare. Quindi mi sento di usare il CQWP e XSLT per formattare l'elenco come. Non credo che l'XSLT dovrebbe essere troppo impegnativo. È possibile iniziare a guardare un po 'di XSLT predefinito. Il mio suggerimento è quello di utilizzare un XSLT "identità" di trasformare in modo che si può vedere il codice XML di input che si sta trasformando, piuttosto che cercare di indovinare questo guardando l'XSLT predefinito.

Esempio identità trasformazione XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Non so se aiuta, ma ho scritto una soluzione che fa questo utilizzando il CQWP. Io lo chiamo il Contenuto Web Part Query Ticker:

http://www.novolocus.com/software/content -query-ticker-web-parte /

Potrebbe essere di interesse.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top