select2 xpages bug?:删除2个或更多字符后页面卡住了

时间:2015-10-16 11:54:24

标签: ajax xpages jquery-select2-3

我确实有一个奇怪的问题。不知道这是不是一个bug。我试图解决它并找到一段时间的解决方法但到目前为止没有任何工作。我希望有人可以帮助我。提前谢谢。

问题描述 在我的select2框中,我输入了一些字符,我得到了一个匹配列表。删除2个或更多字符后,我选择匹配表格列表。那一刻页面卡住了。它已经失去了任何参考。唯一的解决方案是刷新整个页面。

ajax调用工作正常,每次更改都会刷新select2框。 按Enter键执行onchange功能(csjs)。所有函数似乎都有效,因为每个函数之后的调试消息都显示在我的java控制台中。

我的代码

                        <xp:scriptBlock id="scriptBlock3">
                            <xp:this.value><![CDATA[

                var executeOnServer = function ( eventId ) {

// must supply event handler id or we're outta here....

if (!arguments[0])

    return false;

// OPTIONAL - The Client Side ID that you want to partial refresh after executing the event handler
var refreshId = (arguments[1]) ? arguments[1] : "@none";
var form = (arguments[1]) ? XSP.findForm(arguments[1]) : dojo.query('form')[0];

// OPTIONAL - Options object containing onStart, onComplete and onError functions for the call to the

// handler and subsequent partial refresh

var options = (arguments[2]) ? arguments[2] : {};

// OPTIONAL - Value to submit in $$xspsubmitvalue. can be retrieved using context.getSubmittedValue()

var submitValue = (arguments[3]) ? arguments[3] : '';

// Set the ID in $$xspsubmitid of the event handler to execute

dojo.query('[name="$$xspsubmitid"]')[0].value = eventId;

dojo.query('[name="$$xspexecid"]')[0].value = "";

dojo.query('[name="$$xspsubmitscroll"]')[0].value = "0|0";

dojo.query('[name="$$xspsubmitvalue"]')[0].value = submitValue;

XSP._partialRefresh("post", form, refreshId, options);}

x$("#{id:inputTextNieuweStudent}")
.select2({
        placeholder: "Selecteer een student",
        minimumInputLength: 3,
        quietMillis: 750,
        width: '400px',            
        ajax: {
                url: "/Apps/FEZ/SBA.nsf/selecteerStudent.xsp",  
                dataType: 'json',
                data: function (term, page) {
                return {
                    q: term, // search term
                    page_limit: 10,
                    local : true
                };
            },
            results: function (data, page) { // parse the results into the format expected by Select2.
                return data;
            }
        }

})
.on("change", 
    function(e) {
        console.log("changed to " + e.val);
        executeOnServer("#{id:voegToeStudent}", "#{id:lijstStudentSelectie}", {});
    } 
);
   ]]></xp:this.value>
                        </xp:scriptBlock>
                        </xp:inputText>

0 个答案:

没有答案