{I" class:ETI"ProcessedAsset;FI"logical_path;TI"%bootstrap3-autocomplete-input.js;TI" pathname;TI"}D:/mmx/projects/www/myrails/mygems/bootstrap3_autocomplete_input/lib/assets/javascripts/bootstrap3-autocomplete-input.js;TI"content_type;TI"application/javascript;TI" mtime;Tl+آخUI" length;Ti I" digest;TI"%55075be1b757bb972a359cc7de6f3424;FI" source;TI" var autocomplete_data_static = {}; $(document).ready(function() { // local array $( 'input[data-provide="typeahead"][data-source-array]' ).each(function() { obj = $(this); var arr = JSON.parse(obj.attr('data-source-array').replace(/"/g, '"')); obj.typeahead({ source: arr , items: obj.attr('data-items') , minLength: obj.attr('data-min-length') });//typeahead }); // static data from server $( 'input[data-provide="typeahead"][data-source]' ).each(function() { obj = $(this); var name = obj.attr('id'); autocomplete_data_static[name] = {"map":[], "values": []}; $.get(obj.attr('data-source'), function(data){ $.each(data, function (i, row) { autocomplete_data_static[name]["values"].push(row[1]); autocomplete_data_static[name]["map"][row[1]]=row[0]; }); obj.typeahead({ source: autocomplete_data_static[name]["values"] , updater: function (item) { // save the id value the hidden field obj_id = $('#'+obj.attr("data-field-id")); if (obj_id) obj_id.val(autocomplete_data_static[name]["map"][item]); return item; } , items: obj.attr('data-items') , minLength: obj.attr('data-min-length') });//typeahead }, 'json' );//get }); // query data from server $('input[data-provide="typeahead"][data-source-query]').each(function() { obj = $(this); obj.typeahead({ source: function (q, process) { obj = this.$element; rows = []; var name = obj.attr('name'); autocomplete_data_static[name] = {"map":[], "values": []}; // load data from remote server $.getJSON( obj.attr('data-source-query'), {q: q}, function( data ) { $.each(data, function (i, row) { autocomplete_data_static[name]["values"].push(row[1]); autocomplete_data_static[name]["map"][row[1]]=row[0]; }); process(autocomplete_data_static[name]["values"]); } );// get json }//source , updater: function (item) { obj = this.$element; var name = obj.attr('name'); // save the id value the hidden field obj_id = $('#'+obj.attr("data-field-id")); if (obj_id) obj_id.val(autocomplete_data_static[name]["map"][item]); return item; } , items: obj.attr('data-items') , minLength: obj.attr('data-min-length') , afterSelect: function(item){ console.log('go after aselect'); var fn = obj.attr('data-afterSelect') || ''; console.log('fn='+fn); console.log(fn); if (fn!=''){ window[fn](); } } });// typeahead });// each }); ;TI"dependency_digest;TI"%ee6cea7f625204afdb5147ef40f2d0bf;FI"required_paths;T[I"}D:/mmx/projects/www/myrails/mygems/bootstrap3_autocomplete_input/lib/assets/javascripts/bootstrap3-autocomplete-input.js;TI"dependency_paths;T[{I" path;TI"}D:/mmx/projects/www/myrails/mygems/bootstrap3_autocomplete_input/lib/assets/javascripts/bootstrap3-autocomplete-input.js;TI" mtime;TI"2015-03-18T03:02:58+02:00;TI" digest;TI"%7bfb1d5eedfe33f6ecba36f9c197a095;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F