Is there an easy way to add a custom drop down to the editor tool menu?
Thanks!
EDIT - To be more clear, I want to add a new combobox to the menu in the same style as the defaults.
2 Answers, 1 is accepted
0
Alex Gyoshev
Telerik team
answered on 23 May 2012, 01:20 PM
Hello Jeff,
Custom tools can render a template, so you can work with that -- there is no official method for adding new drop-downs. If you feel comfortable with reusing the editor selectbox code, you can do so through the following snippet (note that using the internal widget may break without notice in future versions; using a kendoDropDown is possible):
// initialize the internal editor selectbox widget. could be any official kendo plug-in instead.
var selectBox = new kendo.ui.editor.SelectBox(ui, {
dataTextField: "Text",
dataValueField: "Value",
dataSource: [
{ Text: "one", Value: "one" },
{ Text: "two", Value: "two" }
],
change: function (e) {
alert("changed!");
},
highlightFirst: false
});
// add 'unselectable' attribute so that tools persist selection when clicked
ui.closest(".k-widget").removeClass("k-insertSnippet").find("*").andSelf().attr("unselectable", "on");
Regards,
Alex Gyoshev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!