jquery-select2

Using bootstrap select2 with JqGrid form

北战南征 提交于 2019-11-26 11:24:17
问题 I am trying to implement bootstrap select2 with jqgrid form but can seem to get it right. on the colmodel of the jqgrid declaration I have: {name: \'staff\', index: \'staff\', width: 31, formoptions: {elmprefix: \'(*) \'}, editable: true, editrules: {required: true}, edittype: \'select\', editoptions: {value: staff, dataInit: function(element) { $(element).width(260).select2(); } } }, The options are there and bootstrap classes are inserted into the element, <select id=\"staff\" class=\

Attach click-event to element in .select2-result

二次信任 提交于 2019-11-26 10:46:36
问题 I\'m looking for a way to attach a click-event to a select2-result-item. I\'ve gone ahead and formatted both result and selection via function format(state) { if (!state.id) return state.text; // optgroup return state.text + \" <i class=\'info\'>link</i>\"; } to add an \"info\"-icon I\'m now trying to attach a simple click-event to the .info-element but can\'t get this to work: $(\'.info\').on(\'click\', function(event){ event.preventDefault(); alert(\"CLICK\"); $(\'#log\').text( \"clicked\"

Update select2 data without rebuilding the control

丶灬走出姿态 提交于 2019-11-26 07:48:07
问题 I am converting an <input type=\"hidden\"> to a select2 dropdown and feeding it data through the query method $(\'#inputhidden\').select2({ query: function( query ) { query.callback( data ); // the data is in the format select2 expects and all works well.. ); }); The problem is i needed to hack the select2 UI and position two buttons on top of the search bar that, when clicked, will perform ajax calls and will have to update the select2 content. Now, I need those updates to occur without

Select2 doesn&#39;t work when embedded in a bootstrap modal

孤者浪人 提交于 2019-11-26 04:29:41
问题 When I use a select2 (input) in bootstrap modal, I can\'t type anything into it. It\'s like disabled? Outside the modal select2 works fine. Working example: http://jsfiddle.net/byJy8/1/ code: <!-- Modal --> <div id=\"myModal\" class=\"modal hide fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"myModalLabel\" aria-hidden=\"true\"> <div class=\"modal-header\"> <button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button> <h3 id=\"myModalLabel\">Panel</h3