SharePoint GroupedItemPicker Control
这个控件SharePoint用来选择Field ,和Content Type, 以下是一个完整的示例。

<SharePoint:GroupedItemPicker ID="SelectColumn" runat="server"
CandidateControlId="SelectCandidate"
ResultControlId="SelectResult"
AddButtonId="AddButton"
RemoveButtonId="RemoveButton" />
<table class="ms-long" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="ms-input">
<SharePoint:SPHtmlSelect ID="SelectCandidate" Width="143" Height="125" runat="server" multiple="true" />
</td>
<td style="padding-left: 10px"/>
<td align="center" valign="middle" class="ms-input">
<button id="AddButton" runat="server" style="width:80px">
<SharePoint:EncodedLiteral ID="EncodedLiteral3" runat="server" Text="<%$Resources:wss,multipages_gip_add%>" EncodeMethod='HtmlEncode' />
</button>
<br />
<br />
<button id="RemoveButton" runat="server" style="width:80px">
<SharePoint:EncodedLiteral ID="EncodedLiteral4" runat="server" Text="<%$Resources:wss,multipages_gip_remove%>" EncodeMethod='HtmlEncode' />
</button>
</td>
<td style="padding-left: 10px"/>
<td class="ms-input">
<SharePoint:SPHtmlSelect ID="SelectResult" Width="143" Height="125" runat="server" multiple="true" />
</td>
<td align="center" valign="middle" class="ms-input">
<input type="button" runat="server" id="SelectResultUp" value="Up" onclick="listbox_move(SelectResultID, 'up'); GipSetHiddenControlValue(window[SelectColumnsID + '_m']);"/>
<br />
<br />
<input type="button" runat="server" id="SelectResultDown" value="Down" onclick="listbox_move(SelectResultID, 'down'); GipSetHiddenControlValue(window[SelectColumnID + '_m']);"/>
</td>
</tr>
</table>
服务器端代码:
foreach (SPField field in SPContext.Current.List.Fields)
{
SelectColumn.AddChoice(field.InternalName, field.Title, string.Empty, string.Empty);
}
1 调整选中项的顺序:
function listbox_move(listID, direction) {
var listbox = document.getElementById(listID);
if (direction == "up") {
for (var i = 0; i < listbox.options.length; i++) {
var option = listbox.options[i];
if (option.selected == true) {
listbox_moveOption(listbox, i, direction);
}
}
} else {
for (var i = listbox.options.length-1; i >=0; i--) {
var option = listbox.options[i];
if (option.selected == true) {
listbox_moveOption(listbox, i, direction);
}
}
}
}
function listbox_moveOption(listbox, i, direction) {
var selIndex = i;
if (-1 == selIndex) {
alert("Please select an option to move.");
return;
}
var increment = -1;
if (direction == 'up')
increment = -1;
else
increment = 1;
if ((selIndex + increment) < 0 ||
(selIndex + increment) > (listbox.options.length - 1)) {
return;
}
var selValue = listbox.options[selIndex].value;
var selText = listbox.options[selIndex].text;
listbox.options[selIndex].value = listbox.options[selIndex + increment].value
listbox.options[selIndex].text = listbox.options[selIndex + increment].text
listbox.options[selIndex].selected = false;
listbox.options[selIndex + increment].value = selValue;
listbox.options[selIndex + increment].text = selText;
listbox.options[selIndex + increment].selected = true;
}
2, 更新HiddenField
函数 GipSetHiddenControlValue 位于 "%program files%\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\LAYOUTS\GroupedItemPicker.js"
var groupItemData = [];
for (var i = 0, max = fields.length; i < max; i++) {
options += "<option value=\"" + fields[i].Second + "\">" + STSHtmlEncode(fields[i].First) + "</option>";
groupItemData[i+1] = [fields[i].Second, fields[i].First];
}
spbLookup(this.lookupFieldSelect).html(options);
window[this.context.appearanceColumnsID + "_m"].data = [groupItemData];
spbLookup(this.appearanceColumnsSelectResult).html("");
GipRefreshGroupCore(window[this.context.appearanceColumnsID + "_m"]);
SharePoint GroupedItemPicker Control的更多相关文章
- Sharepoint delegate control
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://sch ...
- SharePoint 2013:自定义ECB菜单项的添加
本文分别介绍了两种常用的添加ECB菜单项的方式. 声明式创建 这也是微软最佳实践推荐的方式.在VS中创建一个SharePoint空解决方案,并添加一个“空元素”类型的SPI. 在Elements.xm ...
- Interoperability between Java and SharePoint 2013 on Premises
http://ctp-ms.blogspot.com/2012/12/interoperability-between-java-and.html Introduction One of the ...
- 错误解决:SharePoint Designer 2010编辑后,出现数据源控件未能执行插入命令,data source control failed to execute the insert command
打了SharePoint 2010 最新的SP 2的补丁,但是使用SharePoint Designer 2010 定义任何一个列表的“插入视图”时,总是出现标题那样的错误: 数据源控件未能执行插入命 ...
- SharePoint 2016 必备组件离线安装介绍
前言 SharePoint 必备组件安装,一直以来都是SharePoint安装过程中的最大的坑,尤其是不能联网的服务器.博主在这里简单介绍一下离线安装过程,并附组件包下载以及安装命令,并且在windo ...
- 实现一个基于 SharePoint 2013 的 Timecard 应用(上)
在 SharePoint 2013 上面实现一个 Timecard 应用的想法来自一个真实的需求,而实现的方案在我脑海里面盘旋已经很久了,终于这几天准备安排点儿时间将它实现出来. “ We start ...
- 如何在SharePoint 当中使用纯JSOM上传任意二进制文件(小于2MB)
在微软的官方网站上有关于如何在SharePoint当中使用JS创建一个简单的文本文件的例子,经过我的思考我觉得结合Html5特性的浏览器,是完全可以通过JS来读取到文件的内容的(这一部分的内容请大家自 ...
- 好像越来越觉得 SharePoint “难用”了
一开始,我觉得 SharePoint 很神秘,不知道它到底是用来做什么的. 后来,我觉得 SharePoint 很强大,能做很多事情. 再后来,我觉得,SharePoint 没有他们宣传的那-么强大, ...
- SharePoint 2013 图文开发系列之自定义字段
SharePoint使用的优势,就在于开箱即用.快速搭建,SharePoint自身为我们提供了很多字段类型,已经很丰富了.但是,在实际应用中,我们还需要一些功能特殊的字段,下面,我们简单介绍下字段的开 ...
随机推荐
- Visual studio 2013安装
最头疼装一些需要安装插件的软件,刚开始下载了VS2013的一个版本,安装到一半就发现还得装一些必要插件,然后得重新删了再安装,倒弄了还几次才装好.这是第一次安装时是出现的情况. 第二次尝试安装,把所有 ...
- Redis客户端开发包:Jedis学习-入门
添加Jedis依赖 我们可以使用以下三种方式来添加Jedis依赖. 1.下载jar文件 从http://search.maven.org/下载最近的jedis包和Apache Commons Pool ...
- CSRF攻击与防御
CSRF是什么 CSRF在百度百科中是这么说的:“CSRF(Cross-site request forgery跨站请求伪造,也被称为“one click attack”或者session ridin ...
- php5.3新特性 之 mysql native driver(mysqlnd)
概述 本文主要写给sa看的.码农就不用看了. mysql native driver(mysqlnd) 自从php5.3.0开始成为官方源代码的一部分, 用来取代传统的mysql client lib ...
- sql server 基础教程[温故而知新三]
子曰:“温故而知新,可以为师矣.”孔子说:“温习旧知识从而得知新的理解与体会,凭借这一点就可以成为老师了.“ 尤其是咱们搞程序的人,不管是不是全栈工程师,都是集十八般武艺于一身.不过有时候有些知识如果 ...
- iOS UIScrollView 无法滚动 没有弹簧效果解决方案
一般情况下,检查如下: 1.没有设置contentSize或者contentSize的尺寸小于等于该scrollView的尺寸 2.scrollView.enable = NO;(仅仅是让scroll ...
- 知道创宇研发技能表v3.1
by @知道创宇(www.knownsec.com) @余弦 & 404团队 后续动态请关注微信公众号:Lazy-Thought 说明 关于知道创宇 知行合一 | 守正出奇 知道创宇是一家黑客 ...
- netfilter-在内核态操作网络数据包
一.概述 netfilter是自2.4内核的一个数据包过滤框架.可以过滤数据包,网络地址和端口转换 ...
- [uwsgi] no request plugin is loaded, you will not be able to manage requests.
Problem: *** Operational MODE: preforking+threaded no app loaded. going in full dynamic mode uWSGI i ...
- elasticsearch 集群搭建
需要编辑的文件是config/elasticsearch.yml文件 需要配置的项目有: # Use a descriptive name for your cluster: # cluster.na ...