1/** 2 * Multi Select Box - jQuery plugin 3 * 4 * @author artherot 5 * @version 1.0 6 * @since 1.0 7 * @copyright Copyright (c), Godosoft 8 */ 9 10/** 11 * ìì±í Select Box ì ìì°¨ì ì¼ë¡ option ê°ì ë£ë ê²ì 12 * JSONì ì´ì©íì¬, option ì íì ë¤ì select boxì ê°ì´ ìëì§ë¥¼ ajax post를 ì´ì©í´ì ë¶ë¬ì´ 13 * @param String Select box default ID 14 * @param integer Select box ê°¯ì 15 * @param String post ë¡ ë길 URL 16 * @param String Select box ì 첫ë²ì§¸ option index name 17 * <code> 18 * JSON ìì : [{"optionValue":"001","optionText":"test"},{"optionValue":"002","optionText":"sample"}] 19 * <script type="text/javascript"> 20 * $(function() { 21 * $('#testSample1').multi_select_box('#testSample',2,'test.php','ì ííì¸ì'); 22 * $('#testSample2').multi_select_box('#testSample',2,'test.php','ì ííì¸ì'); 23 * }); 24 * </script> 25 * </code> 26 */ 27(function($){ 28$.fn.multi_select_box = function(selectID, cnt, url, emptyText) { 29 30 return this.each(function(index, domEle) { 31 32 $(this).change( function(event) 33 { 34 var thisID = event.currentTarget.id; 35 var selectPanel = parseInt(thisID.substr((selectID.length - 1),1)) + 1; 36 var targetID = selectID + selectPanel; 37 var parameters = { mode:'next_select', value:$(this).val() }; 38 var tmpID = ''; 39 40 postCallback = function(data) 41 { 42 if (emptyText !='' && emptyText != null) 43 { 44 for (var i = selectPanel; i <= cnt; i++) 45 { 46 tmpID = selectID + i; 47 $(tmpID).html('<option value="">'+emptyText+'</option>'); 48 $(tmpID).trigger('chosen:updated'); 49 } 50 } 51 data = eval(data); 52 if (data !='' && data != null) { 53 $(targetID).html(''); 54 var k = 1; 55 for (var j = 0; j < data.length; j++) 56 { 57 if(j == 0) 58 { 59 $(targetID).get(0).add(new Option(emptyText,''), document.all ? j : null); 60 } 61 k = k + j 62 $(targetID).get(0).add(new Option(data[j]['optionText'],data[j]['optionValue']), document.all ? k : null); 63 if(data[j]['disabledStr']) { 64 $(targetID+" option:eq("+(j+1)+")").attr("disabled", "disabled"); 65 } 66 67 $(targetID).trigger('chosen:updated'); 68 } 69 } 70 } 71 72 $.post( url, parameters, postCallback ); 73 }); 74 75 }); 76 77} 78})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.