Hi,I'm using an igCombo control with the multiSelection option. When multiple items are selected the input field shows all selected items separated by comma.Is it possible to change that text to something like 'n items selected'. I tried using the "text" method, but that clears the selection.
Hello Robin,
Thank you for posting in the Infragistics community !
I suggest that you use jQuery to set the value for the input field using .val(). This will change the text in the field and will NOT clear the selection:
$(".ui-igcombo-field").val("some text")
Please let me know if you have any further questions on the matter.
Hi,
I have tried to come up with a solution using .val().
The text is set during the selectionChanged event, but when the igCombo control looses focus, the text is changed back again.
I suggest that you set this on the dropDownClosed event:
dropDownClosed: function (evt, ui) { var count = ui.owner.element.igCombo("values").length; ui.owner.element.val(count + " Selected"); }
I tested it and it seems to work just as you would like it to. Please test it and let me know if you have further questions on the matter.
I tried your solution and it works if the drop down list is closed by clicking outside of the control. But when closing the drop down with the drop down button and then clicking somewhere else, the text still changes back.
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
The minimum value for the setTimeout method is 4ms. However this is only valid for HTML5 and consistent across browsers released in 2010 and onward. For other environment different than that the minimum value is 10ms, so it would be expected to face some issues if using value < 10. You can refer to https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers.setTimeout#Minimum_delay_and_timeout_nesting for more details (please note that this site is not owned or maintained by Infragistics)
You should not experience any issue if using value of 10ms even on slow machines. Please let me know if you have any further questions on the matter.
Thanks for the reply. Your sample works.I'm a little curious about the 10ms timeout in the onblur event. I noticed, that the event does not work correctly when the timeout is lower than 10ms. Could this potentially lead to problems on slower clients?
Please let me know if the suggested helped you or if you have any further questions on the matter.
Thank you for your patience as I was examining this behavior along with engineering team. It turned out that this behavior is expected because of the way the igCombo is designed. It is intended to trigger the Dropdown closing event after the onblur() method of the input field. To achieve the functionality you want a more custom approach is necessary that handles the element "blur" event (losing focus).
Please see the attached sample and let me know if it meets your requirement. Looking forward to hearing from you.