createAutoComplete

functioncreateAutoComplete(element, url, init_search, table_id) {

$(element).autocomplete({

source: url,

position: {my:"right bottom",at:"right top"},

minLength: -1,

change:function( event, ui ) {

varrowid=$(element).attr('rowid');

console.log(rowid);

},

create:function( event, ui ) {

if(($(window).height() -$(element).offset().top) <107)

{

$( element ).autocomplete("option","position", {my:"right bottom",at:"right top"} );

}

else

{

$( element ).autocomplete("option","position", {my:"left top",at:"left bottom"} );

}

}

});

$(element).focus(function() {

if(($(window).height() -$(this).offset().top) <107)

{

$(this).autocomplete("option","position", {my:"right bottom",at:"right top"} );

}

else

{

$(this).autocomplete("option","position", {my:"left top",at:"left bottom"} );

}

if(init_search ==true)

{

$(this).autocomplete("search","");

}

});

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容