JSLink to render links list into 2 compartments in webpart section
来源:互联网 发布:mac book air 13寸 编辑:程序博客网 时间:2024/06/03 18:57
Using JSLink to render the UI of the listview webpart
I had a require to display links list webpart into 2 compartments in links webpart section, here is the result:
First, I try to use jQuery to complete it, but it had something wrong when we click the next page in current list, the jQuery won't work.
So, I had to find another way to finish it. it is JSLink, that's greate.
here is the code:
(function () {var itemCtx = {};itemCtx.Templates = {};itemCtx.Templates.Header = "<span></span>";itemCtx.Templates.Item = ItemOverrideFun ;itemCtx.Templates.Footer = ""; itemCtx.BaseViewID = 1;itemCtx.ListTemplateType = 103;SPClientTemplates.TemplateManager.RegisterTemplateOverrides(itemCtx); })(); function ItemOverrideFun(ctx) { return "<div style='padding-left:5px;width:50%;height:26px;min-width:100px;max-width:200px;float:left;'><a href='" + ctx.CurrentItem.URL + "'>" + ctx.CurrentItem['URL.desc'] + "</a></div>";}
at last, upload the js file to display template in master page layout site page.
Note: You should notice the ListTemplateType and choose the JavaScript Display Template when upload the file.
More to link:http://www.learningsharepoint.com/2013/04/04/color-code-list-items-with-javascript-using-js-link-in-sharepoint-2013/
http://www.learningsharepoint.com/2013/04/01/add-task-status-indicators-in-sharepoint-2013-using-js-link/
http://www.learningsharepoint.com/2013/04/01/add-task-status-indicators-in-sharepoint-2013-using-js-link/
- JSLink to render links list into 2 compartments in webpart section
- JSLink to custom list to render people column in detail with picture
- Swift reason: 'attempt to insert row 10 into section 0, but there are only 10 rows in section
- chap8_1 Render to texture in OGRE
- How to Log into H2 Database Console in Grails 2
- a method to set the title of webpart in code
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL(ZZ)
- How to render "asp:Label" as "label" in HTML markup.
- GPU深度发掘(四)::Render to Vertexbuffer in OpenGL
- Render to Texture2DArray slices in DirectX11?(转自GAMEDEV)
- How to Render Image Buffer in Android NDK Native Code
- How to Render Image Buffer in Android NDK Native Code
- use grep & awk to get ed2k links in the webpage
- Create links to PyQt5 and Qt Creator in PyCharm
- How to softly clip 2d bitmap? (section 7.6.2 in book wgp1)
- NSInternalInconsistencyException', reason: 'attempt to insert row 0 into section 0, but there are on
- error: address doesn't contain a section that points to a section in a object file
- .net SMTP发送Email实例(可带附件)
- 将excel内的数据导入mysql数据库
- Spring Batch之FlatFile操作
- 葡萄引擎项目 -> 非常简单的Golang服 + C#客户端. TCP协议.
- ActiveMQ学习(一)——MQ的基本概念
- JSLink to render links list into 2 compartments in webpart section
- VC工程是用那个版本的VC创建的
- 买不起360随声wifi怎么办?这些都不是问题
- 在iOS虚拟键盘上添加动态隐藏按钮
- 腾讯笔试
- 任意输入三个整数,要求从小到大输出
- 软件测试发展方向
- java实现链表
- ActiveMQ学习(二)——MQ的工作原理