0

I have the following Kendo Menu:

<div id="menu"></div>

<script>
    console.log("executes")
    $("#menu").kendoMenu({
        dataSource: [{
            text: "menu", icon: "k-icon k-i-more-horizontal", items: [
                { text: "Edit", spriteCssClass: "k-icon k-i-edit" },
                { text: "Delete", spriteCssClass: "k-icon k-i-delete" },
            ]
        }

        ]
    });
</script>

Since spriteCssClass is not recommended [https://www.telerik.com/forums/spritecssclass-is-not-working-with-icons-in-latest-version] , I tried icon:... as you can see in the first line of the dataSource. But that does not work, too.

How can I put Kendo some icons into a Kendo Menu ?

thestruggleisreal
  • 940
  • 3
  • 10
  • 26

2 Answers2

0

I solved it simply putting a < span > into text and setting encoded: false.

   $("#menu").kendoMenu({
        dataSource: [{
            text: "<span class=\"k-icon k-i-more-horizontal\"></span>", encoded: false, items: [
                { text: "<span class=\"k-icon k-i-edit\"></span><span>Edit</span>", encoded: false },
                { text: "<span class=\"k-icon k-i-delete\"></span><span>Delete</span>", encoded: false }
            ]
        }]
    });
thestruggleisreal
  • 940
  • 3
  • 10
  • 26
0

You can also use FontAwesome icons in the Kendo UI Menu as explained in the following article:

Ceco Milchev
  • 377
  • 3
  • 11
  • Unfortunately, the docs are outdated - I wrote that spriteCssClass is not supported anymore in my question, But referring to my own answer: replacing the k-icon class in the -Tag with a fontawesome class would work. – thestruggleisreal Oct 31 '18 at 15:32
  • In order to use the spriteCssClass field, you have to set the styles for the k-sprite class explicitly. Check out the sample project here: https://dojo.telerik.com/aDOTUvet It is using the latest Kendo UI version - 2018.3.1017 – Ceco Milchev Oct 31 '18 at 15:42
  • I tried it with the styles for the k-sprite class and it did not work. Maybe I did sth wrong elsewhere. – thestruggleisreal Nov 02 '18 at 08:22