How can I get the value of the selected item from igcombo

1.1k Views Asked by At

I need to get value of the selected item from igcombo to use in an if condition to show and hide a panel.

function GetPerfType() {
  var BEFilteJSon = {};
  BEFilteJSon.SVC_FEE_TYPE_ID = $("#SVC_FEE_TYPE_ID").igCombo("value");
  var json = "{'filterObj' : '" + JSON.stringify(BEFilteJSon);
  json += "'}";
  var data = callAjaxMethod("GetFeesData", json);
  var IS_PER = data[0].IS_PERFORMANCE_FEES_TYPE;
  if (IS_PER == "Y") {
    $("#YES").show();
  } else {
    $("#YES").hide();
  }
}
1

There are 1 best solutions below

0
On

Calling:

$('selector').igCombo('value');

will return:

  • empty array if nothing is selected;
  • in single selection igCombo the value of the property assigned to valueKey of the selected item. For example if you have set for your igCombo valueKey to id and textKey to name, if selected item has this data {id: 56, name: 'USA'} value will return 56.
  • in multiple selection igCombo an array of all values of all selected item related to the value key. Same as in single selection but array of values. If you have same setup and selected items are {id: 56, name: 'USA'} and {id: 23, name: 'Canada'} value will return [56, 23].