Like

Welcome On Mobius

Mobius was created by professionnal coders and passionate people.

We made all the best only for you, to enjoy great features and design quality. Mobius was build in order to reach a pixel perfect layout.

Mobius includes exclusive features such as the Themeone Slider, Themeone Shorcode Generator and Mobius Grid Generator.

Our Skills

WordPress90%
Design/Graphics75%
HTML/CSS/jQuery100%
Support/Updates80%

JQuery Auto-complete widget source fill statically

By Muhammad Gardezi 6 years ago

How to fill Autocomplete widget source with Ajax request data and populate specific list of data in the autocomplete field, Basic functionality enables users to quickly find and select from a pre-populated list of values but we use to fill autocomplete source by filling array with object that contain label and value.

1-Create an array

var myArray1 = new Array();

2-Ajax calling for rendering data to fill array

success: function (result) {

$.each(result.d, function (key, item) {

myArray1.push({ “label”: item.Option1, “value”: item.value });

});

3-Make require field for autocomplete and set properties

  • Set source myArray1
  • Set minimum length 0
  • Set Maximum length 10
  • Set Scroll true
  • Set Select property for do any functionality

$(“#fieldname “).autocomplete({

source: myArray1,

minLength: 0,

max: 10,

scroll: true,

select: function (event, ui) {

//do any functionality

return false

}

});

4-You can pop out all source label data

$(“#fieldname “).autocomplete(“search”, “”);

5-You can close on dialog close event

$(“#dialog”).dialog({

Close:function(){

$(“$(“#fieldname”).autocomplete(‘close’);

} });

6- You can find more help

http://api.jqueryui.com/autocomplete/

 

 

Category:
  Technology
this post was shared 0 times
 000
About

 Muhammad Gardezi

  (4 articles)

Muhammad Gardezi is a Senior Software Engineer in Allied Consultants. With a experience over 4 years in ...................... , . He is one of the key resources of .Net framework for the organization.