ListViewWebPart query issue while paging

本文介绍了一种解决SharePoint中ListViewWebPart搜索分页返回错误结果的方法。通过使用特定JavaScript函数过滤结果并重新提交表单,可以有效解决此问题。此外,还讨论了不同WebPart间ctxId冲突导致的问题及解决方案。

If we change a ListView WebPart's query to implement search while paging, we may get the wrong result.

Use javascript function like this when execute query can solve the problem.

function FilteResult() {
        var filterFrame = document.getElementById('FilterIframe' + ctx.ctxId);
        if (typeof (filterFrame) == 'undefined' || filterFrame == null) {
            document.forms[0].submit();
            return;
        }
        var postUrl = filterFrame.getAttribute('FilterLink');
        var postUrl = postUrl.replace('Filter=1&', '');
        SubmitFormPost(postUrl);
    }

But I still not quite understand about this.

According to jianyi, it was not written by him so he also doesn't know what it is. But it really works.

 

Get some info from internet:

 

Something else to try if you are still having this problem: I had 2 XSLT DataView WebParts on a WebPart page in SharePoint. Each was looking at a different document library. Links for each document would work fine, but when I would hover over a document and click "View Properties" in one of the webparts, it tried to redirect me to a list item in the other list! What gives?!?! After hours of painstakingly comparing the two webparts and trying to find out the common thread, I stumbled on this nondescript call: ctx.ctxId = In both webparts, this value was the same. When you look at the javascript and ID nomenclature of the HTML contained within, this value is used to differentiate Javascript objects from one webpart to another. So for example: One of the objects is an IFrame. Its name is not "FilterIframe". It is "FilterIframe<somenumber>". When SharePoint's javascript calls are made, this number is used to find the IFrame of the webpart for which the call was intended. So, when I found out 2 of these webparts had the same ctxId, I just took the XSLT of one, pasted it into Notepad, and replaced with a . Pasted the webpart back in and all is well! Cheers, Jeremy http://www.budnack.net/Lists/Posts/Post.aspx?ID=22
According to this, each webpart on a page has a iframe container called FilterIframe<number> to find a webpart's iframe.
And most important, thanks Yunliang!
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值