PDA

View Full Version : how to capture a barcode scanner event globally



r6174
13 Jul 2014, 11:43 PM
Hi can anybody please help me out in using barcode scanner with 3.X...the requirement is, when a barcode is scanned, i need to display the info in a plain window ,irrespective of where the cursor is currently placed..:((

mitchellsimoens
16 Jul 2014, 4:20 AM
Will the barcode scanner just enter what was scanned in a textfield?

r6174
16 Jul 2014, 4:46 AM
@mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens) yes ,the scanner will just read the data and writes in textfield and send a request to backend with the scanned value as a param value

mitchellsimoens
16 Jul 2014, 5:01 AM
So it sends a request I'm assuming to get the information for what was scanned? Is there a means of listening to that request?

r6174
16 Jul 2014, 5:10 AM
@mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens) no..i need to know what action has to be listened ..i tried with keypress and and blur listeners for text field but no use :-/..some how i got following code to get the scanned value



'render': function(c) {
c.getEl().on('keypress', function(event) {
barcodelistenerevent(event);
}, c);
}

mitchellsimoens
16 Jul 2014, 5:13 AM
Since the barcode scanner likely isn't actually integrated into Ext and using the setValue on the field, it likely just changes the value of the input using native javascript. For this you'd actually have to do a little hacking to add the onchange attribute on the actual <input> node created by the Ext field.

r6174
16 Jul 2014, 5:16 AM
Thanks @mitchellsimoens (http://www.sencha.com/forum/member.php?22216-mitchellsimoens) =P~ i got some idea but how can i make it as a global action instead of displaying the scanned value in a text field and using onchange on that....this is for user friendly exp...where user can track the product info where ever he may be (on any tab in the screen) instead of going to particular place