Dear all,
I am creating an Inventory Management System and I have an scenario where i am using 2 dropdownlists to fill in a requisition, One dropdown is to select the ItemName and the other dropdownlist is to select the VendorName.
Now, i would like to use Jquery Autocomplete feature on both the dropdownlists. For example, if i select a
Pen from the first dropdownlist (ItemName) so the second dropdownlist should have the filter out only those vendors that provide
Pen, lets say out of 1000 vendors only 500 are providing pen so my second dropdownlist should contain only those 500 vendors and it should also be based on Jquery AutoComplete feature.
I have done only the first part that is completed the Jquery Autocomplete feature on ItemName but that is also done on textbox i would like to do it on DropDownList and also then to filter out vendors based on Item selected and apply the Jquery Autocomplete on second dropdownList aswell.
Below is the code used so far.
function InitRow(tr){
var fld=$(".txt_item_name",tr);
fld.data('row',tr);
fld.removeClass('ui-autocomplete-input');
fld.autocomplete({
select:function(e,ui){
var src_ele=$(e.target);
var _tr=src_ele.data('row');
var label = ui.item.label;
var value = ui.item.value;
$('.vendor-name', _tr).val(ui.item.val.VENDOR_NAME);
$('.vendor-id', _tr).val(ui.item.val.VENDOR_ID);
$('.price', _tr).val(ui.item.val.PRICE);
$('.min-qty', _tr).val(ui.item.val.MIN_QTY);
},
source: function (request, responce) {
$.ajax({
url: "CreatRequistion.aspx/GetItemNames",
type: "post",
contentType: "application/json;charset=utf-8",
data: JSON.stringify({ term: request.term }),
dataType: 'json',
success: function (data) {
responce($.map(data.d, function (item) { return {label: item.ITEMS_DESCRIPTION,val: item} }))
},
error: function (err) {
alert(err);
}
});
}
});
}
What I have tried:
Have tried looking for solutions through google but unable to find one