Telerik Forums
Kendo UI for jQuery Forum
2 answers
715 views

Hi all,

 

I try to add a watermark on an export to pdf using template model but it doesn't work.

somebody know how to do this ?

here the link of my try :

https://dojo.telerik.com/aGOHaDUt

<!DOCTYPE html>
<html>
<head>
    <style>html { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }</style>
    <title></title>
 
     
     
 
 
 
</head>
<body>
   
<script type="x/kendo-template" id="page-template">
      <div class="page-template">
        
        <div class="watermark">C O N F I D E N T I A L</div>
         
      </div>
</script>
   
<div id="example">
    <div id="gantt"></div>
</div>
 
<style>
    /*
        Use the DejaVu Sans font for display and embedding in the PDF file.
        The standard PDF fonts have no support for Unicode characters.
    */
    .k-gantt {
        font-family: "DejaVu Sans", "Arial", sans-serif;
    }
 
    /* Hide toolbars during export */
    .k-pdf-export .k-gantt-toolbar
    {
        display: none;
    }
   
    .page-template .watermark {
        font-weight: bold;
        font-size: 400%;
        text-align: center;
        margin-top: 30%;
        color: #aaaaaa;
        opacity: 0.1;
        transform: rotate(-35deg) scale(1.7, 1.5);
    }
</style>
 
<script>
    // Import DejaVu Sans font for embedding
 
    // NOTE: Only required if the Kendo UI stylesheets are loaded
    // from a different origin, e.g. cdn.kendostatic.com
    kendo.pdf.defineFont({
        "DejaVu Sans"             : "https://kendo.cdn.telerik.com/2016.2.607/styles/fonts/DejaVu/DejaVuSans.ttf",
        "DejaVu Sans|Bold"        : "https://kendo.cdn.telerik.com/2016.2.607/styles/fonts/DejaVu/DejaVuSans-Bold.ttf",
    });
</script>
 
<!-- Load Pako ZLIB library to enable PDF compression -->
 
<script>
$(document).ready(function() {
    var serviceRoot = "https://demos.telerik.com/kendo-ui/service";
    var tasksDataSource = new kendo.data.GanttDataSource({
        batch: false,
        transport: {
            read: {
                url: serviceRoot + "/GanttTasks",
                dataType: "jsonp"
            },
            update: {
                url: serviceRoot + "/GanttTasks/Update",
                dataType: "jsonp"
            },
            destroy: {
                url: serviceRoot + "/GanttTasks/Destroy",
                dataType: "jsonp"
            },
            create: {
                url: serviceRoot + "/GanttTasks/Create",
                dataType: "jsonp"
            },
            parameterMap: function(options, operation) {
                if (operation !== "read") {
                    return { models: kendo.stringify(options.models || [options]) };
                }
            }
        },
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { from: "ID", type: "number" },
                    orderId: { from: "OrderID", type: "number", validation: { required: true } },
                    parentId: { from: "ParentID", type: "number", defaultValue: null, validation: { required: true } },
                    start: { from: "Start", type: "date" },
                    end: { from: "End", type: "date" },
                    title: { from: "Title", defaultValue: "", type: "string" },
                    percentComplete: { from: "PercentComplete", type: "number" },
                    summary: { from: "Summary", type: "boolean" },
                    expanded: { from: "Expanded", type: "boolean", defaultValue: true }
                }
            }
        }
    });
 
    var dependenciesDataSource = new kendo.data.GanttDependencyDataSource({
        transport: {
            read: {
                url: serviceRoot + "/GanttDependencies",
                dataType: "jsonp"
            },
            update: {
                url: serviceRoot + "/GanttDependencies/Update",
                dataType: "jsonp"
            },
            destroy: {
                url: serviceRoot + "/GanttDependencies/Destroy",
                dataType: "jsonp"
            },
            create: {
                url: serviceRoot + "/GanttDependencies/Create",
                dataType: "jsonp"
            },
            parameterMap: function(options, operation) {
                if (operation !== "read" && options.models) {
                    return { models: kendo.stringify(options.models) };
                }
            }
        },
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { from: "ID", type: "number" },
                    predecessorId: { from: "PredecessorID", type: "number" },
                    successorId: { from: "SuccessorID", type: "number" },
                    type: { from: "Type", type: "number" }
                }
            }
        }
    });
 
    var gantt = $("#gantt").kendoGantt({
        dataSource: tasksDataSource,
        dependencies: dependenciesDataSource,
        views: [
            { type: "week", selected: true },
            "month"
        ],
        columns: [
            { field: "id", title: "ID", width: 60 },
            { field: "title", title: "Title", editable: true, sortable: true },
            { field: "start", title: "Start Time", format: "{0:MM/dd/yyyy}", width: 100, editable: true, sortable: true },
            { field: "end", title: "End Time", format: "{0:MM/dd/yyyy}", width: 100, editable: true, sortable: true }
        ],
        toolbar: ["append", "pdf"],
        pdf: {
            fileName: "Kendo UI Gantt Export.pdf",
            proxyURL: "https://demos.telerik.com/kendo-ui/service/export",
            template: $("#page-template").html()
        },
        height: 700,
 
        showWorkHours: false,
        showWorkDays: false,
 
        snap: false
    }).data("kendoGantt");
 
    $(document).bind("kendo:skinChange", function() {
        gantt.refresh();
    });
});
</script>
 
 
 
</body>
</html>

 

thx for help :)

Ry
Top achievements
Rank 1
 answered on 23 Apr 2020
7 answers
785 views
I am using kendo grid to populate data in that grid i use HTML table as datasource. With the help initialization from table demo sample i loaded data in grid. But my problem is to show pagination for that grid?
Viktor Tachev
Telerik team
 answered on 22 Apr 2020
3 answers
846 views

Hello,

Do you have a localization support ?

Can the date picker be shown an Hebrew text for the months ?

 

Thx

Sagi

Viktor Tachev
Telerik team
 answered on 22 Apr 2020
3 answers
430 views
When I try to run the a function, the grid does not detect this and gives an error.
Preslav
Telerik team
 answered on 22 Apr 2020
3 answers
304 views

To start I am super new to kendo and I have really enjoyed it.

I have written a custom edit method which launches a kendoDialog when the edit command button on the grid is clicked containing that specific grid row's data (to be edited) the issue I'm having is that it only works one time. After that, when I click edit the dialog appends to the DOM but with a display of none. So if I wanted to edit another record I would have to refresh the screen which obviously isn't ideal. I have a feeling I am just missing something and thought someone might be able to see something I'm missing/need to add. Here is the code:

 

Here is the command in my grid:

{ command: {text:"Edit", click:GetMessageToUpdate}, title: " ", width: "90px" }

 

This is the GetMessageToUpdate function:

    function GetMessageToUpdate(e) {
        e.preventDefault();
        var grid = $("#messagesGrid").data("kendoGrid")

        var obj = { messageID: grid.dataItem(e.toElement.closest("tr")).messageID };

        $.ajax({
            url: "URL_FOR_UPDATE_METHOD",
            type: "POST",
            data: JSON.stringify(obj),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            error: function (response) {
                $("#errorRemove").show();
            },
            success: function (response) {
                console.log(response.Data)
                let msgObj = response.Data
                renderUpdateModal(msgObj)
                $('#updateErrorMessage').hide()
                $('#updateSuccessMessage').hide()
                cache: false
            }
        })
    }

This is the code for the renderUpdateModal:

 function renderUpdateModal(obj) {
        console.log(obj)
        $("#editContainer").kendoDialog({
            width: "450px",
            title: "Edit Message",
            closable: true,
            modal: true,
            content: `Here is where the dialog code lives I didn't think it was important but if you need it I can supply it!`
          });

any help or suggestions are super appreciated. 

 

Thanks,

Jordan

Georgi
Telerik team
 answered on 22 Apr 2020
7 answers
62 views

Is there any documentation on how to implement the search bar that can be found on the telerik website? (see attachment)

The idea is to be able to accept users' input, while giving the option of limiting search in the different grid-columns, for example: All, Col1, Col2. 

 

Thanks in advance!

 

 

 

syian
Top achievements
Rank 1
Veteran
 answered on 22 Apr 2020
1 answer
173 views

Is it possible to place several elements on one page?

Only one element works fully

Aleksandar
Telerik team
 answered on 22 Apr 2020
5 answers
2.5K+ views

Hi there,

I'm struggling to make a kendo numeric textbox control make the user input as readonly but allow the user to use the spinner.  The readonly method makes the control not usable entirely.  I want only the user input box to be disabled, but the spinner should be working as is.

Is there any method or configuration that I can use? or does this feature is not supported on the current version?

 

 

Regards,

Junius

Nikolay
Telerik team
 answered on 21 Apr 2020
3 answers
1.6K+ views

I am using Kendo grid with angular js. In some cases the data in grid is long text like "New, Initial Auto-Polling Config, Auto-Polling " or greater in length. I want all data to be displayed the data is getting trimmed down and ellipsis getting added making above text as "New, Initial Auto-Polling Conf.."

Also the inner HTML dooesn't have the original text.

Please help me best possible solution to display the text

 

 

 

Viktor Tachev
Telerik team
 answered on 21 Apr 2020
4 answers
543 views

I'm loading Kendo Grid in a modal window over the same HTML element. The grid has grouping implemented on it.

Now when I try to collapse the rows it works first time, but when I try to close the modal and re-open another kendo grid which is again on the same HTML element  the collpase button does not work. it will work the 3rd time i.e. it works every alternate times I open the window

Things I haved tried so far

Clearing html before grid initialization

Destroying kendo grid before initialization

Any help will be appreciated.

Muhammad
Top achievements
Rank 1
Iron
 answered on 21 Apr 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?