通过jQuery控制SharePoint展现——计算栏KPI和标签云
====================SharePoint 2010应用开发系列--把JQuery框架集成到SharePoint中=======================
Query是我们在做SharePoint 2010开发的时候使用的比较频繁的JS类库。本文向大家介绍一种简单方便的方式,把JQuery框架集成到我们的SharePoint中。我们来创建这样一个Feature.
还是使用Visual Studio 2010.
1. 创建一个空SharePoint项目“Empty SharePoint Project”。
2. 修改默认创建的Feature,重命名成JQuery,修改其对应的Title和Description。
3. 创建一个普通的自定义控件,添加类文件,命名成jQueryControl.cs,该类继承自System.Web.UI.Control,重写其CreateChildControls方法,创建一个Microsoft.SharePoint.WebControls.ScriptLink子控件,来把JQuery.js引用到页面中。
具体代码如下:
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Web.UI;
- using Microsoft.SharePoint.WebControls;
- using System.Web.UI.WebControls;
- namespace JQuery
- {
- public class JQueryControl : Control
- {
- protected override void CreateChildControls()
- {
- ScriptLink JQueryScriptLink = new ScriptLink();
- JQueryScriptLink.Name = "jQuery/jquery.js";
- JQueryScriptLink.Localizable = false;
- this.Controls.Add(jQueryScriptLink);
- base.CreateChildControls();
- }
- }
- }
4. 为项目添加element,命名JqueryElements,在elements.xml文档中,为上面的JQueryControl控件创建注册信息:
- <?xml version="1.0" encoding="utf-8"?>
- <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
- <Control Id="AdditionalPageHead" Sequence="0"ControlAssembly="$SharePoint.Project.AssemblyFullName$" ControlClass="JQuery.JQueryControl" />
- </Elements>
5. 将JQuery.js脚本文件附加到项目中。我们把它放到Layouts目录中,使用Visual Studio 2010可以很方便的做到这一点,如图,在项目中创建一个Layouts下的映射目录,命名成JQuery:
将JQuery.js文件上载到该目录中。
6. OK,搞定,编译,发布.
7. 在”Site Collection Features”中已经有了我们的这个Feature.
在对应的Layouts下,也有我们对应的JQuery目录:
==============================================================
jQuery Library for SharePoint Web Services
==============================================================
http://tech.ddvip.com/2010-08/1282634163159390_5.html
http://www.cnblogs.com/Sunmoonfire/archive/2010/07/30/1788470.html
http://www.mosstec.cn/showtopic-101.aspx
http://weblogs.asp.net/jan/archive/2009/07/02/sharepoint-search-as-you-type-with-jquery.aspx
http://www.cosdiv.com/page/M0/S215/215141.html +++++++++++
http://www.byywee.com/page/M0/S215/215009.html
http://www.sharepointbrainfreeze.com/archive/2010/02/01/combining-jquery-ui-dialogs-and-sharepoint-webparts.aspx
http://tothepoint.inproc.com/creating-mega-drop-down-navigation-in-sharepoint-2007-with-jquery/
http://paulgalvin.spaces.live.com/blog/cns!1CC1EDB3DAA9B8AA!3991.entry +++
http://www.bitsofsharepoint.com/ExamplePoint/default.aspx ++++++++++++
http://blogs.msdn.com/b/sharepoint/archive/2007/04/26/customizing-the-quick-launch-menu-adding-fly-out-menus-to-sharepoint-navigation.aspx !!!!!!!!!!
http://www.sharepointsaturday.org/richmond/Lists/MeetingResources/JQuery%20and%20SharePoint.pdf
http://wss.lennontechnologies.com/blog/Materials/RoanokejQuery.pptx
http://visuallightbox.com/#example
利用jQuery定制Sharepoint的WebPart样式
http://kb.cnblogs.com/a/1306809/
以异步AJAX方式访问SharePoint数据
http://kaneboy.blog.51cto.com/1308893/285912
用于构建SharePoint解决方案的10个最佳实践
http://msdn.microsoft.com/zh-cn/magazine/dd458798.aspx