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","");
}
});
}