設(shè)為首頁收藏本站Access中國

Office中國論壇/Access中國論壇

 找回密碼
 注冊

QQ登錄

只需一步,快速開始

返回列表 發(fā)新帖
查看: 2421|回復(fù): 0
打印 上一主題 下一主題

[其他] 【轉(zhuǎn)】office365 列表自定義與數(shù)據(jù)展示

[復(fù)制鏈接]

點擊這里給我發(fā)消息

跳轉(zhuǎn)到指定樓層
1#
發(fā)表于 2018-11-23 15:18:31 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式

一、列表數(shù)據(jù)的展示
1.可以在一個頁中加入自定義的列表(如果用rest api會有權(quán)限問題),將列表隱藏。
2.在前臺用Jquery來查調(diào)用列表數(shù)據(jù),進行數(shù)據(jù)的展示。

二、列表數(shù)據(jù)的管理
xslt自定義列表數(shù)據(jù)(創(chuàng),修,刪)
1.自定義xslt 參見http://blog.csdn.net/wyaspnet/article/details/24517363
2.  main.xsl
  internal.xsl

要保留,可以調(diào)用系統(tǒng)的定義路徑及數(shù)據(jù)。
3.在apply-templates中加入<xsl:sort>排序。
<xsl:apply-templates select="/dsQueryResponse/Rows/Row">
    <xsl:sort data-type="number" select="@no" order="ascending"/>
</xsl:apply-templates>
<Xsl>
<!--xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:ddwrt2="urn:frontpage:internal"
-->

<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:pcm="urnageContentManager" xmlns:ddwrt2="urn:frontpage:internal" xmlns="urn:schemas-microsoft-comfficeffice" ddwrt:ghost="show_all">

  <xsl:include href="/_layouts/15/xsl/main.xsl"/>
  <xsl:include href="/_layouts/15/xsl/internal.xsl"/>

<xsl:output method="html" indent="yes"/>
   <xsl:template match="/" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal" 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" xmlns:pcm="urnageContentManager" xmlns:o="urn:schemas-microsoft-com:office:office">

<a href="msall.aspx" target="_self">管理</a>
<table border="1">
<tr>
<td>選擇</td>

<td>序號</td>
<td>廣告標題</td>

<td>圖片</td>
<td>圖片說明</td>

<td>鏈接地址</td>
<td></td>

</tr>
<xsl:apply-templates select="/dsQueryResponse/Rows/Row">
    <xsl:sort data-type="number" select="@no" order="ascending"/>
</xsl:apply-templates>

</table>

</xsl:template>

    <xsl:template match="Row" ddwrt:ghost="" xmlns:ddwrt2="urn:frontpage:internal">
     <xsl:param name="thisNode" select="."/>
      <xsl:variable name="titlevalue" select="$thisNode/@Title"/>


<tr>
<td>
<input type="checkbox" name="chid">

<xsl:attribute name="value">

<xsl:value-of select="@ID"/>

</xsl:attribute>
</input>
</td>
<td>
<xsl:value-of select="@no"/>
</td>
<td>
<xsl:value-of select="@Title"/>
</td>
<td>
<img  width="100" height="30" alt="">
<xsl:attribute name="src">

<xsl:value-of select="@picimg"/>

</xsl:attribute>
</img>
</td>
<td>
<xsl:value-of select="@linkurl.desc"/>

</td>
<td>
<a target="_blank">
<xsl:attribute name="href">

<xsl:value-of select="@linkurl"/>

</xsl:attribute>
<xsl:value-of select="@linkurl"/>

</a>
</td>
<td>
<a>

<xsl:attribute name="href">
<xsl:value-of select="$FORM_EDIT"/>&amp;ID=<xsl:value-of select="@ID"/>&amp;ContentTypeId=<xsl:value-of select="@ContentTypeId"/>
</xsl:attribute>
編輯
</a>

</td>
</tr>
</xsl:template>

</xsl:stylesheet></Xsl>
<DataFields>
</DataFields>
<XmlDefinition>



三、編輯
1.字段調(diào)用與隱藏
<div style="display:none">      
      <SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="Edit" FieldName="picimg" __designer:bind="{ddwrtataBind('u',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@picimg')}"/>

       <SharePoint:FieldDescription runat="server" id="ff2description{$Pos}" FieldName="picimg" ControlMode="Edit"/>
</div>
<div id="divimg">     
       <SharePoint:FormField runat="server" id="ff5{$Pos}" ControlMode="Display" FieldName="picimg" __designer:bind="{ddwrtataBind('u',concat('ff5',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@picimg')}"/>

       <SharePoint:FieldDescription runat="server" id="ff5description{$Pos}" FieldName="picimg" ControlMode="Display"/>

</div>      

2.上傳文檔
<a href="javascript:cc()" runat="server">上傳圖片</a>
         <a href="javascript:bb()" runat="server">選擇圖片</a>
<script src="//ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js" type="text/javascript"></script>

         <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js" type="text/javascript"></script>

         <script src="/_layouts/15/sp.runtime.js" type="text/javascript"></script>

         <script src="/_layouts/15/sp.js" type="text/javascript"></script>

         <script src="/_layouts/15/sp.ui.dialog.js" type="text/javascript"></script>


         <script type="text/javascript">
    var ss;
    $(document).ready(function(){
         // cc();
          var u=           $(&quot;input[title=&apos;picimg&apos;]&quot;).val();   
      $(&quot;#imgurl&quot;).attr(&quot;src&quot;,u);
   });
   function bb(){
     var options={
      arg:null,
      width:800,
      height:350,
      title:&quot;查看圖片&quot;,
url:&quot;/adver/forms/slt.aspx&quot;,                 dialogReturnValueCallback:dialogCallback
    };         
              ss=SP.UI.ModalDialog.showModalDialog(options);

   }
  function cc(){           
   var options={
      arg:null,
      width:800,
      height:350,
      title:&quot;上傳圖片&quot;,
url:&quot;/_layouts/15/upload.aspx?list=%7Bc1e7c6c2-928b-49d3-b880-3ade236330d0%7D&amp;rootfolder=&amp;isdlg=1&quot;,                 dialogReturnValueCallback:dialogCallback
    };         
              ss=SP.UI.ModalDialog.showModalDialog(options);


  }
  function dialogCallback(dialogResult,ReturnValue){         
    if(dialogResult==SP.UI.DialogResult.OK){                    $(&quot;input[title=&apos;picimg&apos;]&quot;).val(ss.$k_0.newFileUrl);        
    $(&quot;input[title=&apos;說明&apos;]&quot;).first().val(ss.$k_0.newFileUrl);
    $(&quot;#divimg&quot;).html(&quot;<img src="+ss.$k_0.newFileUrl+" />&quot;);            
      alert(&quot;ok&quot;);
   }else{
      alert(&quot;non&quot;);
   }
  }      


  </script>   


---------------------
作者:xiaoxiru
來源:CSDN
原文:https://blog.csdn.net/wyaspnet/article/details/26483947
版權(quán)聲明:本文為博主原創(chuàng)文章,轉(zhuǎn)載請附上博文鏈接!



分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 分享淘帖 訂閱訂閱
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則

QQ|站長郵箱|小黑屋|手機版|Office中國/Access中國 ( 粵ICP備10043721號-1 )  

GMT+8, 2025-7-17 00:30 , Processed in 0.101658 second(s), 24 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回復(fù) 返回頂部 返回列表