So, in jQuery's autocomplete you are able to do something like this:
$("input#loc").autocomplete({ source: "mylocations.php", minLength: 3, select: function( event, ui) { $('#loc').val(ui.item.label); $('#bldg').val(ui.item.bldg); //autocomplete bldg loadRooms(); } });
Is there any way to get additional data elements returned with the json? If not, how does one even get the selectedValue? Thanks!
Hello Jodi,
Thank you for posting in our community!
I have several questions before investigating further: Could you clarify which Ignite UI control you are using?
If your scenario does not include Ignite UI controls but jQuery widgets only I could redirect you to the jQuery autocomplete widget API:
http://api.jqueryui.com/autocomplete/
To the Ignite UI editor controls – the igEditor and igTextEditor for instance have a few methods for getting the selection:
getSelectedListItem:
var item = $(".selector").igEditor("getSelectedListItem");
var
item = $(".selector").igEditor("getSelectedListItem");
getSelectedText:
var text = $(".selector").igEditor("getSelectedText");
text = $(".selector").igEditor("getSelectedText");
getSelection:
$(".selector").igEditor("getSelection",true);
You might find more detailed information in the “METHODS” section of the following resource: http://help.infragistics.com/jQuery/2013.2/ui.igeditor
In order to understand better your scenario could you give more information on what data elements exactly are returned with the json? A more detailed sample would be appreciated.
Looking forwards to hearing from you.
We are using the igCombo control. Our jsondata returns both the text needed to be displayed in the combobox as well as the "code" that needs to be passed to a function that will then load a second picklist (but not an igCombo control, just an old-fashioned one).
Basically - we want two linked picklists, both initially empty. As the user starts typing in the first one the igCombo control should do the nice filtering, when a user picks a value we want to fire a function that populates the second picklist with data.
Thanks!
If you have additional questions or concerns on this matter feel free to update the thread.
Thank you for your reply.
The igCombo has a built-in option “parentCombo” which is used to natively connect two separate combo boxes:
$("#comboDistrictCascading").igCombo({
cascadingDataSources: dsCascStatesDistricts,
autoComplete: true,
parentCombo: $("#comboCountryCascading")
});
The igCombo has different options for text field and value key. The ‘textKey’ is used to initialize the text displayed in the drop down list and ‘valueKey’ is designed to keep the ‘code’:
var dsCountryCascading = [
{ txtCountry: "United States", valCountry: "US" },
{ txtCountry: "Bulgaria", valCountry: "BG" },
];
$("#comboCountryCascading").igCombo({
textKey: "txtCountry",
valueKey: "valCountry",
dataSource: dsCountryCascading,
I have attached a sample for your reference.
If you have any additional questions feel free to update this thread.