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
1170
Select combo by value
posted

Any idea why this is not working 

<div id="combo"></div>
<button onclick = SetValue>SetByValue</button>

<script>
$(function () {

var data = [
{ "ID":1, "Name": "John Smith", "Age": 45 },
{ "ID":2, "Name": "Mary Johnson", "Age": 32 },
{ "ID":3, "Name": "Bob Ferguson", "Age": 27 }
];

$("#combo").igCombo({
dataSource: data, //JSON Array defined above
valueKey: "ID",
textKey: "Name",
itemTemplate: "<div>${ID} - ${Name}</div>"
});
});

function SetValue(){
var item = $("#combo").igCombo("itemByValue", "2");
$("#combo").igCombo("selectedIndex", item.index);

}
</script>

I want to select combo based on  value. According to this post it should work http://ko.infragistics.com/community/forums/p/68712/347998.aspx

-Manish

  • 11095
    Offline posted

    Hello,

    I'm just following up to see if you need any further assistance with this issue. If so please let me know.

  • 11095
    Offline posted

    Hello Manish,

    Thank you for contacting Infragistics Developer Support!

    Please refer to the following, I believe it might be help to resolve your issue. Also as I can see you are trying to select item with value of type string - "2", but I am not able to see any keys of type string for your combo. Your value type should match the type of your key.

    Please let me know if you have any additional questions.