This is a migrated thread and some comments may be shown as answers.

Autocomplete not working with Barcode scanner

3 Answers 388 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
saroj
Top achievements
Rank 1
saroj asked on 15 Apr 2015, 11:36 PM

I'm using autocomplete for editing column inside the Kendo grid. The idea is when users type barcode or scan barcode in the edit cell, autocomplete will give them list of items containing entered text.

The autocomplete works well when I type barcode by keuboard, but when I use the barcode scanner, it seem they can't detect the change and not call method in read action in server.

I also tried with change event of autocompete and call ajax to the same method in read action. But it said $("#PARTCODE").data("kendoAutoComplete") is undefined. The function is below.

Can you please let me know anyway to make autocomplete works with barcode scanner?

Thanks

  function onPartCodeChange(e)

    {
        debugger;
       

        $.ajax({
            url: "@Url.Action("GetPartCodesFromPartAndSupplier", "Shared")",
            data: { text: e.sender._old },
            dataType: "json",
            type: "POST",
            async: true,
            success: function (myData) {
                debugger;
                if(myData.length==0)
                    {
                          alert("No matching barcode found.");              
                    }
                else
                {
                    
                    $("#PARTCODE").data("kendoAutoComplete").dataSource.data(myData);
                  
                    }
               
            }

        });
      
        }

3 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 17 Apr 2015, 01:13 PM
Hello saroj,

I am not sure I understand the scenario very well, but you could try using the AutoComplete's search or suggest methods.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
saroj
Top achievements
Rank 1
answered on 20 Apr 2015, 12:06 AM

Hi Alexander,

I called the search method  and it returns the list suggestion item, but with barcode reader autocomplete can't detect the select event. The barcode reader works like you copy text then enter. Anyway to trigger select event with the first item in the suggestion list.

I tried with  .HighlightFirst(true) and  autocomplete.select(autocomplete.ul.children().eq(0)), but it didn't jump to Select event.

Thanks,

Saroj

 

0
Alexander Popov
Telerik team
answered on 21 Apr 2015, 01:51 PM
Hi Saroj,

You can try triggering the event manually after the selection was done. For example: 
autocomplete.trigger("select");

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
AutoComplete
Asked by
saroj
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
saroj
Top achievements
Rank 1
Share this question
or