Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Yogeshkad/8a36d17f66e8fa02beaaff74e5ead2d3 to your computer and use it in GitHub Desktop.
Save Yogeshkad/8a36d17f66e8fa02beaaff74e5ead2d3 to your computer and use it in GitHub Desktop.
Extjs 3 - Barcode Reader Example
var barcodeWin = new Ext.Window({
title: 'Scan Barcode',
width: 220,
height: 110,
//minWidth: 300,
//minHeight: 200,
layout: 'fit',
plain: true,
bodyStyle: 'padding:5px;',
buttonAlign: 'center',
closable: true,
items: new Ext.form.FormPanel({
baseCls: 'x-plain',
url:'save-form.php',
labelWidth: 50,
defaultType: 'textfield',
items: [{
name: 'sid',
xtype : 'hidden'
},{
name: 'code',
id: 'barcodeField',
fieldLabel: 'Code',
anchor: '100%',
enableKeyEvents: true,
xtype: 'numberfield',
listeners: {
keypress : function(field, e) {
if (e.getKey() == Ext.EventObject.ENTER ) {
//Ext.Msg.alert('Barcode Reader','Isi Barcode : ' + field.getValue());
spin.StoreSpp.reload({params:{sppid: field.getValue()}});
gridPermohonanSpp.getSelectionModel().selectRow(0);
gridPermohonanSpp.fireEvent('rowclick', grid, 0);
barcodeWin.close();
}
}
}
}]
}),
buttons: [{
text: 'Batal',
iconCls: 'logout',
handler: function(thisbutton) {
barcodeWin.close();
}
}]
});
barcodeWin.show();
barcodeField = Ext.getCmp('barcodeField');
barcodeField.focus(true, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment