Autocomplete not working with Barcode scanner

4 posts, 0 answers
  1. saroj
    saroj avatar
    39 posts
    Member since:
    Oct 2011

    Posted 15 Apr 2015 Link to this post

    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);
                      
                        }
                   
                }

            });
          
            }

  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 17 Apr 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. saroj
    saroj avatar
    39 posts
    Member since:
    Oct 2011

    Posted 19 Apr 2015 in reply to Alexander Popov Link to this post

    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

     

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 21 Apr 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready