I having trouble getting allowCustomValue behavior to work correctly on the igcombo in 2016.2. There are 2 issues:
1. If the combo contains a value say ABCD and i want to add the custom value ABCD2 then it displays the message no matching records and clears off the combo. I can add WXYZ. So i need it to not match the data source.
2. The entered custom text doesnt work with ko binding. In the below example, I am expecting _selectedLot to get updated even when a custom text is entered but that doesnt work.
igCombo: {width: '100%', height: '25px', caseSensitive: false, compactData: false, dataSource: someArray , placeHolder: ' ', highlightMatchesMode: 'multi', hideEnterKey: false, selectionChanged: lotSelectionChangedEvent, selectedItems: _selectedLot,tabIndex:-1, selectedItemType : 'object', itemTemplate: '<div class=\'comboTemplate\'><div class=\'comboInfo\'><span class=\'emphasizedText\'>{{Lot}}</span></div></div>', textKey: 'Lot', valueKey: 'Lot', mode: 'editable', allowCustomValue: true}
Hello Deepti,
Thank you for posting in our forums!
I am able to reproduce the behavior of issue #1 and can see a difference in behavior when not using knockout.
I have created a support case for you with an ID of CAS-180484-S8V9T3. The matter has been determined to be a development issue and has been logged in our tracking system with ID: 231070.
I will leave this case open and update you with any new information. You can view the status of the development issue connected to this case by going to the “Account” tab on our website, selecting "My Support Activity" and then this support case will be listed there. Then, you may select the "Development Issues" tab to view details of this development issue.
For issue #2, Do you mean that the _selectedLot is not removing previously matched items from the viewmodel? Please provide a detailed example, including steps to reproduce, of the behavior your are seeing and the result you are expecting to see.
Please let me know if you have any questions.
Issue 2: When I use a custom value I expect it to bind to the model _selectedLot but after entering a custom value _selectedLot is still empty and i have to retrieve the custom value using the following code.
let element = $("#avilablelotDS").igCombo("textInput"); this._customLot = (<HTMLInputElement>element)[0].value;
is this still the best way to get the custom value though?
let element = $("#avilablelotDS").igCombo("textInput"); this._customLot = (element)[0].value;
Hi Deepti,
You can get the value from the input by using the igCombo's value method:
this._customLot = $("#avilablelotDS").igCombo("value");
If you need anything else, please let me know.
the selectionchanged event is not getting fired when a custom value is entered.
After looking into that, the recommended approach is to handle the input event binding for KO for the igCombo. The selectionChanged event will not fire since the selection is not changing when typing a custom input. That was an oversight in my last response.
Using this method also negates my previous answer and you would need to use the following code in your ViewModel to get the value:
In your ViewModel:
function ViewModel() { ... this.lotSelectionChangedEvent = function(vm, evt) { this._customLot = $(evt.currentTarget).val(); }, ...}
In your markup:
<input id="koCombo" data-bind="igCombo{ width: '100%', height: '25px', caseSensitive: false, compactData: false, dataSource: colors, placeHolder: ' ', highlightMatchesMode: 'multi', hideEnterKey: false, selectedItems: _selectedLot, tabIndex: -1, selectedItemType: 'object', itemTemplate: '<div class=\'comboTemplate\'><div class=\'comboInfo\'><span class=\'emphasizedText\'>${Lot}</span></div></div>', textKey: 'Lot', valueKey: 'Lot', mode: 'editable', allowCustomValue: true}, event: { input: lotSelectionChangedEvent }" />
If you have any further questions with this, please let me know.
Please let me know if u have an ETA for the case.
The issue has been replicated in our github repo and has been resolved already. You can find more information on it here:
https://github.com/IgniteUI/ignite-ui/issues/746