Radsearchbox is working fine when user input is by typing or copy-paste but when the input is from barcode reader radsearchbox not fire Search event.
¿Can i use an alternative event?
1 Answer, 1 is accepted
0
Doncho
Telerik team
answered on 30 May 2022, 12:45 PM
Hi Adrián,
In case you have control over the scanned text via JavaScript, you can programmatically set the text to the SearchBox and trigger the query.
For instance:
var scannedText = "a"; //use the text comming from the barcode scanner //get a reference to the SearchBox control objectvar searchBox = $telerik.findControl(document,"RadSearchBox1")
var inputElement = searchBox.get_inputElement();
//remove the styling for the Empty message, if such is used
$telerik.$(inputElement).removeClass("rsbEmptyMessage");
//set the text
inputElement.value = scannedText;
//trigger query with the scanned text
searchBox.query(scannedText, true);//The second parameter defines whether all results should be shown in the drop-down.
A more specific approach would depend on if the scanned text is applied via pasting or set as a value in some other way. It would be very useful if you share information on how the barcode scanner is populating the text inside the RadSearchBox.
I hope you will find this information helpful.
Please let me know if any questions come up.
Kind regards,
Doncho
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.