A few days ago, gregor.wolf4, one of my fellow SAP Mentors was looking for a UI5 control that would display a QR codes:
When I first started experimenting with custom controls, I have been experimenting with a couple of Javascript libraries, including the great QR library by Kazuhiko Arase. I believe at that time, I started experimenting with this library because it was possible to re-render the QR codes without rendering the entire DOM element, a feature that UI5 can leverage in its custom controls.
As I still had this custom control lying around, I decided to polish it up and release it under an MIT license on Github:
https://github.com/jpenninkhof/openui5-qrcode/
Here’s a screenshot of the control in action:
Installation is quite similar to any other custom control:
// Register custom controls
var modulePath = jQuery.sap.getModulePath(this.getManifestObject().getComponentName());
jQuery.sap.registerModulePath("com.penninkhof.controls", modulePath + "/control");
<mvc:View
controllerName="com.penninkhof.qrcode.controller.Main"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:mvc="sap.ui.core.mvc"
xmlns:p="com.penninkhof.controls"
xmlns="sap.m">
<p:QRCode code="Awesome code" />
Of course you could also bind the code to a model:<p:QRCode code="{/code}" />
To play around with the control, check out this demo-app on:
https://jpenninkhof.github.io/openui5-qrcode/
Enjoy! And please do feel free to fork and contribute on Github!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |