Display number of replies in disscussion board
来源:互联网 发布:列生成算法思想 编辑:程序博客网 时间:2024/06/08 18:30
how to display number of replies in disscussion board
I have a require about display the replies' number in disscussion board, finish it via jQuery.
First, get the number of the replies of each items via client object model,
then store the number into array.
at last, show it in page via jQuery .
here is the code.
<script type="text/javascript"> $(document).ready(function(){ ExecuteOrDelayUntilScriptLoaded(retrieveListItems, "SP.js");});function retrieveListItems() { var clientContext = new SP.ClientContext.get_current(); var oList = clientContext.get_web().get_lists().getByTitle('Dis1'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml('<View><Query>' + '<OrderBy>'+ '<FieldRef Name="DiscussionLastUpdated" Ascending="False"></FieldRef>'+'</OrderBy>'+ '</Query><RowLimit>20</RowLimit></View>'); this.collListItem = oList.getItems(camlQuery, 'Include(ItemChildCount)'); clientContext.load(collListItem); clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed)); }function onQuerySucceeded(sender, args) {var arr = new Array();var listItemInfo = ''; var listItemEnumerator = collListItem.getEnumerator(); arr.length = 0; while (listItemEnumerator.moveNext()) { var oListItem = listItemEnumerator.get_current(); listItemInfo = oListItem.get_item('ItemChildCount'); arr.push(listItemInfo); } $('#forum0-PostList>li').each(function(index){ $(this).find('div.ms-comm-postMainContainer').css({"float":"left", "width":"90%"}); var arrValue = arr.shift() $(this).find('div.ms-comm-postMainContainer').after("<div class = 'div_showNumber' style = 'float:left;font-size:20px;width:10%;background-color:gray;color:white;width:30px;height:30px;text-align:center;'>" + arrValue + "</div>");}); }function onQueryFailed(sender, args) { alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());}</script>
- Display number of replies in disscussion board
- Display row number in af:table
- Number of actions are more than display limit 25.
- Battleships in a Board
- Battleships in a Board
- Battleships in a Board
- Battleships in a Board
- Display of CDPOS fields VALUE_OLD, VALUE_NEW in SE16
- Customized display of collection data in a PropertyGrid
- Customized display of collection data in a PropertyGrid
- Counting number of line in a file
- Number of files in each directory
- lexical scanner of number token in lcc
- Number of Bits in a Decimal Integer
- lintcode:Number of Airplanes in the Sky
- Wrong number of segments in token:
- list number of physical RAM in use
- lintcdoe: Number of Airplanes in the Sky
- android的layout布局种类
- 对NotificationManager和方法notify的理解
- android-serialport-api
- zlib压缩中uncompress函数返回Z_DATA_ERROR错误!!!
- B_树的C实现原理插入、删除、查找的原理
- Display number of replies in disscussion board
- eclipse下axis2创建web service(四)
- HDU1384 差分约束
- hsql使用架构包启动数据库
- _stdcall与_cdecl的区别
- hdu3389 Game
- Windows下Git配置与安装
- UITableViewCell
- xen tapdisk2 装机重启关闭磁盘过程中发生错误