on 07-07-2018 6:43 AM
Hi All,
Iam using Barcode scanner in my fiori app. Every thing is working fine....
But my client requirement is once he finish the scan, then immediately again another scan should be opened with out pressing button.
I done this requirement by using firePress event.But i am getting an issue like below.
First time when i press button and cancel, then from next time only its working as per requirement
So, how can i achieve it from first press onwards..
Thanks in advance,
Surya..
Hi,
First thanks to rakesh and Gregor for your response.
You can find my code below.
In View:
var oScanButton = new sap.ndc.BarcodeScannerButton({id: "barc",
provideFallback: true,
visible: true,
scanSuccess: onScanSuccess,
scanFail: onScanError,
inputLiveUpdate: onScanLiveupdate
});
now in function onScanSuccess.
function onScanSuccess(oEvent)
{
if (oEvent.getParameter("cancelled"))
{
sap.m.MessageToast.show("Scan cancelled", { duration:1000 });
}
else
{
aData.push({Sname: oEvent.getParameter("text")}); // Push data to Model
oModel.setData({modelData: aData}); // Set Model
sap.ndc.BarcodeScanner.closeScanDialog();
sap.ui.getCore().byId("barc").getAggregation("_btn").firePress();
}
}
this code is working fine like below.
1. when i press scan button ,
come back and cancel dialog.
now again press scan button . then only the repeated scan is working fine with out pressing scan button next time onwards.
otherwise i am getting an message like "barcode scan is already started."
Please help me.
Regards,
Surya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Surya,
As much as I understood your requirement, I think you should not fire the button again
sap.ui.getCore().byId("barc").getAggregation("_btn").firePress();/// remove this
instead call the:
sap.ndc.BarcodeScanner.scan
directly after first successful scan.
Hope I understood your requirement correctly. Let me know if it worked.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.