Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
Select item from igCombo by Value
posted

I'm loading JSON data into an igCombo via the dataSource property. I've set the valueKey of the igCombo to a property of the JSON data. I would like to select an item from the igCombo by the value of the property set by the valueKey.

---------------------

var jsonData = [
{textValue: "this is dummy data", importantId: 1 },
{textValue: "this is also dummy data", importantId: 2 }
]
 
$("#checkboxSelectCombo1").igCombo({
width: "270px",
dataSource: jsonData,
textKey: "textValue",
valueKey: "importantId"
});
 
//Now I need to add code that would select the second item
//("{textValue: "this is also dummy data", importantId: 2}")
//from the igCombo.
//The API suggests that the "select" method
//(http://www.igniteui.com/help/api/2015.2/ui.igcombo#methods:select)
//should be used.
//Neither of these lines work as expected.

$("#checkboxSelectCombo1").igCombo("select", jsonData[1]);
$("#checkboxSelectCombo1").igCombo("select", {importantId: 2});
$("#checkboxSelectCombo1").igCombo("select", 2);

---------------------