This is a migrated thread and some comments may be shown as answers.

Generate QrCode in Editor

1 Answer 166 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Ruairi
Top achievements
Rank 1
Ruairi asked on 30 Mar 2017, 11:14 AM

Im using the Kendo UI Editor and I'd like to dynamically display QrCodes into the Editor.

So Ive added a Custom Tool Button item that calls the following method:

function insertQRCodeTest() {
    var editor = getEditor();
    var qrCodeDiv = "<div id='qrCode1'></div>";
    editor.exec("insertHtml", { html: qrCodeDiv, split: false });
 
    $("#qrCode1").kendoQRCode({
      value: " my data here...",
      errorCorrection: "M",
      size: 120,
      border: {
        color: "#000000",
        width: 5
      }
    });
  }

 

The qrCode1 div is added however the QrCode is not genearted\displayed - is this even possible?

1 Answer, 1 is accepted

Sort by
0
Accepted
Ianko
Telerik team
answered on 31 Mar 2017, 10:53 AM

Hello Tyler,

You can. In your case, however, if you are using the classic editor (iframe content area) $("#qrCode1") would not return you the element inserted. Thus, you will not have a QR generated. 

Instead, you can handle that by using dynamic DOM elements without beeing added to the DOM of the editor's content area. Plus, use the QRCode API to just get the QR code and not gave the entire widget instance in the content. Here you are an example: http://dojo.telerik.com/IFUkA

Regards,
Ianko
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Editor
Asked by
Ruairi
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or