Case 1: XML
To disable the input box in the barcode scanner in SAP UI5, you can set the property showInputBar
of the barcode scanner control to false
. This will hide the input box and prevent it from being displayed even if the camera fails to open or the scan fails.
Here’s an example code snippet showing how to disable the input box in a SAP UI5 barcode scanner control:
var oScanner = new sap.ndc.BarcodeScanner(); oScanner.showInputBar = false;
You can also set the showInputBar
property directly in the XML view definition of the barcode scanner control, like this:
<ndc:BarcodeScanner showInputBar="false" />
By setting the showInputBar
property to false
, the input box in the barcode scanner will be disabled and hidden from the user interface.
Case 2: Controller
sap.ndc.BarcodeScanner.scan
method, you can modify your code as shown below:sap.ndc.BarcodeScanner.scan( function(oScanData) { console.log("Scanning Success: " + oScanData); var n = oScanData.text; if (n.length > 0) { var scannedText = oScanData.text; } }, function(e) { console.log("Scanning failed: " + e); }, { showInputBar: false // Disable the input box in the barcode scanner } );
In the sap.ndc.BarcodeScanner.scan
method, we have added an options parameter as the third argument, which is an object containing the options for the barcode scanner. We have set the showInputBar
property of the options object to false
to disable the input box in the barcode scanner.
By setting the showInputBar
property to false
, the input box in the barcode scanner will be disabled and hidden from the user interface even if the camera fails to open or the scan fails.
0 Comments