如何使用JavaScript在SharePoint Online中编辑列? [英] How do I edit colum in SharePoint Online using JavaScript?

查看:77
本文介绍了如何使用JavaScript在SharePoint Online中编辑列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

希望你好;

在SharePoint列表上添加的javaScript代码是什么,用于显示每行的几行文本,因此它们的大小相同,其中大量文本已经写入,这是通过滚动或展开箭头可以应用它对所有观点。

What is javaScript code to add on SharePoint list for showing a few lines of text per row so they all the same size where reams of text have been written this is via scroll or expand arrow can it be applied to all views.

这是我找到的代码:

< script>

<script>



if(typeof jQuery =='undefined'){

var jQPath ='https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min。 js'

document.write('< script src ="',jQPath,'">< \ / script>');

}< / script>< style>


if(typeof jQuery=='undefined'){
var jQPath = 'https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js'
document.write('<script src="',jQPath,'"><\/script>');
} </script><style>

.expandText {

  HEIGHT:auto

}

.collapseText {

  OVERFLOW:hidden;高度:18px

}< / style>< script>

.expandText {
 HEIGHT: auto
}
.collapseText {
 OVERFLOW: hidden; HEIGHT: 18px
}</style><script>



函数ExpGroupRenderData(htmlToRender,groupName,isLoaded){

$(" #tbod" + groupName +" _")。attr(" isloaded",isLoaded)


.html(htmlToRender)

.show("fast",collapseText(" #tbod" + groupName +" _"));


}

函数collapseText(group){

if(!group)group ="#MSO_ContentTable" ;;

var html ="< img alt ='collapseText'style ='cursor:pointer;'src ='/ _ layouts / images / menudark.gif'/>" ;;


$(group +" td.ms-vb2> div")。each(function(i,e){

$(e)。 css({display:" inline-block"});

if(e.clientHeight> 35){

$(e).toggleClass(" collapseText" ;)

.prepend(html);

}

});

$(group +" img [alt ='collapseText']")。click(function(event){
$
$(event.target).parent( ).toggleClass(" collapseText");

});

}

$(function(){

collapseText();

});


function ExpGroupRenderData(htmlToRender, groupName, isLoaded) {
$("#tbod"+groupName+"_").attr("isloaded",isLoaded)
.html(htmlToRender)
.show("fast",collapseText("#tbod"+groupName+"_"));
}
function collapseText(group){
if (!group) group = "#MSO_ContentTable";
var html = "<img alt='collapseText' style='cursor:pointer;' src='/_layouts/images/menudark.gif'/>";
$(group+" td.ms-vb2>div").each(function(i,e){
$(e).css({display:"inline-block"});
if (e.clientHeight > 35){
$(e).toggleClass("collapseText")
.prepend(html);
}
});
$(group+" img[alt='collapseText']").click(function(event){
$(event.target).parent().toggleClass("collapseText");
});
}
$(function() {
collapseText();
});

< / script>

</script>

它适用于2010 sharepoint网站,但适用于SharePoint Online。

It workes on 2010 sharepoint site but on SharePoint Online.

亲切的问候,

Anees

推荐答案

嗨Anees,

Hi Anees,

对于SharePoint 2013 / Online,我们可以使用下面的代码来实现它。将代码添加到列表视图页面的脚本编辑器Web部件中。

For SharePoint 2013/Online, we can use the code below to achieve it. Add the code into script editor web part in the list view page.

<style type="text/css">
.collapseText {
	OVERFLOW: hidden; 
	HEIGHT: 18px
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript">


(function(){
collapseText();
});

函数collapseText(){
var html ="< img alt ='collapseText'style ='cursor:pointer;'src ='/ _ layouts / images / menudark.gif' />" ;;
(function(){ collapseText(); }); function collapseText(){ var html = "<img alt='collapseText' style='cursor:pointer;' src='/_layouts/images/menudark.gif'/>";


(&.; ms-listviewtable td.ms-vb2> div")。each(function(i,e){
(".ms-listviewtable td.ms-vb2>div").each(function(i,e){


这篇关于如何使用JavaScript在SharePoint Online中编辑列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆