草庐IT

initSelection

全部标签

javascript - angular-ui select2 initSelection 没有被调用

我的页面上有一个angular-uiselect2组件。当用户输入内容时它工作正常(它使用ajax加载数据)。但是initSelection函数永远不会被调用。这是我传递给select2的配置对象{multiple:true,minimumInputLength:1,tokenSeparators:[",",""],createSearchChoice:function(term){returnterm;},width:'resolve',ajax:{url:'...',method:'GET',quietMillis:100,data:function(term,page){...}

javascript - 如果 initSelection() 未在 select2 插件中定义错误,则无法调用 val()

我正在使用select2插件加载远程数据。我正在使用一个返回JSON数据的aspx页面,并将其分配给select2插件。用户从select2文本框中选择一些值后,我强制页面回发。回发后,我使用以下代码重新加载以在select2文本框中设置文本。vardata={"PatientID":"XYX","Email":"testing@gmail.com"};$('#e6').select2('val','123');但系统抛出以下错误:如果未定义initSelection()则无法调用val()即使我定义了init,我也无法设置值。我正在使用以下代码。请帮我在回发后设置select2文本框

javascript - 正确使用 jQuery select2 的 initSelection 回调与远程数据

我使用jQueryselect2插件来使用提供的ajax回调函数检索邮政编码,如下所示:$(document).ready(function(){$("#postcodes").select2({placeholder:"Searchforapostcode",multiple:true,minimumInputLength:3,ajax:{url:"/bignibou/utils/findGeolocationPostcodeByPostcodeStartingWith.json",dataType:'json',data:function(term){return{postcode

javascript - 在 select2 jquery 插件中没有调用 initSelection

我正在使用来自http://ivaynberg.github.io/select2/的select2jquery插件.我正在使用以下代码。$(document).ready(function(){$("#e6").select2({placeholder:"Searchforamovie",minimumInputLength:1,ajax:{//insteadofwritingthefunctiontoexecutetherequestweuseSelect2'sconvenienthelperurl:"http://api.rottentomatoes.com/api/public