Kendo Grid Column Template Read More

pada kasus ini column yang dibuat template adalah column yang berisi text dari kendo editor.

function previewOSDescOnClick(e) {
            var value = $(".preview-description").attr("data-val");
            var $modal = $("#modalPreview").clone(),
                $modalBody = $modal.find(".modal-body"),
                $modalTitle = $modal.find(".modal-title"),
                $btnClose = $modal.find("#btnClose");

            //modal on show event
            $modal.on("shown.bs.modal", function (e) {
                $modalTitle.text("Preview Description");
                $modalBody.append($("<div />").html(value).text());
                //set btn close click event
                $btnClose.on("click", function (e) {
                    $modal.modal("hide");
                });
            });

            //modal on hide event
            $modal.on("hide.bs.modal", function (e) {
                setTimeout(function () {
                    e.target.remove();
                }, 1000);
            });

            //show modal
            $modal.modal({
                backdrop: "static"
            });
        }

    <script type="text/x-kendo-tmpl" id="statusTemplate">
        <div>
            # if (Status.length > 250) { #
            #= $("<div />").html(Status.substring(0,250)).text() #
            <a class="preview-description" href="javascript:void(0)" 
            onclick="previewOSDescOnClick()" data- 
            val="#=kendo.htmlEncode(Status)#">(...)</a>
            # }else { #
            #= $("<div />").html(Status).text() #
            # } #
        </div>
    </script>

Santi has written 5 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>