Change barcode encoding at runtime in a template

2 posts, 0 answers
  1. Menashay
    Menashay avatar
    8 posts
    Member since:
    Jul 2012

    Posted 19 Jun 2014 Link to this post

    How would you change the barcode encoding at runtime if the barcode widget is used in a template?
    To clarify, user selects barcode type from a dropdown list, according to selection the barcode changes.
    The barcode widget is used in a listview as a template.
    For example, in the listView -

    <script type="text/x-kendo-tmpl" id="aTemplate">
            <div class="product">
                    .Encoding(BarcodeSymbology.Code128)       <-- how whould you change this at runtime?

  2. Alexander Popov
    Alexander Popov avatar
    1411 posts

    Posted 24 Jun 2014 Link to this post

    Hi Menashay,

    This could be achieved by subscribing to the change event of the DropDownList. Once the event is triggered, get the instance of the Barcode and use the setOptions method to apply the new encoding, then redraw the widget. For example: 
    var barcode = $("#Id_123456").getKendoBarcode();
    barcode.setOptions({type: this.value()}); //taken from the DropDownList's value method

    Alexander Popov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. UI for ASP.NET AJAX banner
Back to Top