Search code examples
kendo-uikendo-gridkendo-combobox

Kendo grid - Adding a combobox and a icon to the same column


If you have a kendo grid, is it possible to have a combobox and an icon in the same column? Basically using an editor and a command? Or the other question is to use an editor for a command column.

Thanks!


Solution

  • Use an editor function that is something like this:

    editor: function (container, options) {
        // Add icon
        $('<span class="k-icon k-add"></span>').appendTo(container);
        // Add container for the combobox
        var span = $('<span></span>').appendTo(container);
        // Define the combobox
        $('<input name="' + options.field + '"></input>')
                .appendTo(span)
                .kendoComboBox({
                    dataSource: [ "Seatle", "Madrid", "Sofia", "Palo Alto" ]
                });
    }
    

    It might be done more compact but here I try to make clear the different steps instead of chaining more functions.

    Running example here: http://jsfiddle.net/OnaBai/ehnSq/12/ Try editing City