Skip to content

Instantly share code, notes, and snippets.

@StErMi
Last active June 22, 2017 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StErMi/3614854278979b0c46c6d8000593a299 to your computer and use it in GitHub Desktop.
Save StErMi/3614854278979b0c46c6d8000593a299 to your computer and use it in GitHub Desktop.
init: function() {
this.setAggregation("__qrcodeHTML", new HTML({
content: "<div class='openui5-qrcode' id='" + this.getId() + "-qrcode'></div>"
}));
},
onAfterRendering: function() {
var iCorrectLevel = this.getCorrectLevel() < 0 || this.getCorrectLevel() > 3 ? QRCode.CorrectLevel.H : this.getCorrectLevel();
if( this.__qrcode ) {
this.__qrcode._htOption.width = this.getWidth();
this.__qrcode._htOption.height = this.getHeight();
this.__qrcode._htOption.colorDark = this.getColorDark();
this.__qrcode._htOption.colorLight = this.getColorLight();
this.__qrcode._htOption.correctLevel = iCorrectLevel;
if( this.getText() ) {
this.__qrcode.makeCode( this.getText() );
} else {
this.__qrcode.clear();
}
} else {
this.destroyQRCode();
this.__qrcode = new QRCode( jQuery.sap.domById( this.getId() + "-qrcode" ), {
text: this.getText(),
width: this.getWidth(),
height: this.getHeight(),
colorDark: this.getColorDark(),
colorLight: this.getColorLight(),
correctLevel: iCorrectLevel
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment