Select item from igCombo by Value
New DiscussionI’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);
———————
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
2 Created On
May 05, 2016 Last Post
9 years, 10 months ago