Nixoderm
Nixoderm

Reputation: 355

Kendo UI toolbar align

In Kendo UI Grid toolbar buttons. I wondering it is possible to align excel and pdf only to the righthand side of the panel. And Create will maintain at left side.

toolbar: ["create", "excel", "pdf"],

I have been try .k-grid-toolbar a { float:right; } ,but it align all button to the right.

Thanks

Upvotes: 0

Views: 3839

Answers (3)

Shai
Shai

Reputation: 3872

You can use CSS to do it. The buttons have fixed class names you can use.

See the snippet for a demo:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>Kendo UI Snippet</title>

    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.common.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.rtl.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.silver.min.css"/>
    <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2019.1.220/styles/kendo.mobile.all.min.css"/>

    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="https://kendo.cdn.telerik.com/2019.1.220/js/kendo.all.min.js"></script>
  
    <style>
        .k-grid-toolbar {
            display: flex;
            flex-direction: row;
            justify-content: flex-start;
            align-items: center;
        }
      
        .k-grid-toolbar .k-grid-excel {
            margin-left: auto;
        }
    </style>
</head>
<body>
  
<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  toolbar: ["create", "excel", "pdf"],
  columns: [
    { field: "name" },
    { field: "age" }
  ],
  dataSource: {
    data: [
      { id: 1, name: "Jane Doe", age: 30 },
      { id: 2, name: "John Doe", age: 33},
    ],
    schema: {
      model: { id: "id" }
    }
  },
  editable: true
});
</script>
</body>
</html>

Upvotes: 2

Carsten Franke
Carsten Franke

Reputation: 1669

You could access a specific link in CSS by its index with :nth-child(), see https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-child

Upvotes: 0

Rico Koldi
Rico Koldi

Reputation: 386

You can use toolbar: kendo.template($("#template").html()) for it. Take a look at this demo for an example.

Upvotes: 0

Related Questions