qr scanner integration for search button ?

qr scanner integration for search button ?

fatihfxfatihfx Posts: 9Questions: 3Answers: 0
edited October 2021 in DataTables 1.9

How to add qr scanner for search button ?

I did see this (https://datatables.net/blog/2020-07-10)
but I want to add for search button.

Thank you.

Answers

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    You will create an event handler for your qr scanner. In the event handler get the qr code then use search() or column()search() to search for the code.

    Kevin

  • fatihfxfatihfx Posts: 9Questions: 3Answers: 0

    can you create a working example ?

  • kthorngrenkthorngren Posts: 20,425Questions: 26Answers: 4,794

    Assuming you are using the same scanner instascan library as in the blog you would do something like this:

        scanner.addListener('scan',function(content){
            table.search( content ).draw();
    
            // Or for a specific columns search
    
            table.column( 1 ).search( content ).draw();
        });
    

    The docs explain the content parameter:

    content: Scanned content decoded from the QR code.

    To build an example would take a bit of time. If you want to build an example that reflects the solution you want to deploy we can help with the Datables specifcs.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

Sign In or Register to comment.