Want/neet to always show dropdowns and checkboxes

2 posts, 0 answers
  1. Joe
    Joe avatar
    220 posts
    Member since:
    May 2012

    Posted 10 Feb 2017 Link to this post

    When I load data into a grid via a DataSourceRequest based Read action, I would like a column to always show a dropdown.  As it stands currently, in my limited experience, you either have to double click a row for InCell editing or click an Edit button for the PopUp editor, all interaction with the DataSourceRequest based Update action.  But I don't want my users to have to clikc a button, nor double click a row.  How can I show a dropdown in a specific column, for all rows without having to activate an edit mode?  Is it possible?  And I assume, I would have to use the Batch mode?
  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 14 Feb 2017 Link to this post

    Hello Joe,

    Editors in ClientTemplate are not officially supported, but you can use MVVM initialization and binding to achieve it. For your convenience, following is a simple example demonstrating how to bind a checkbox:
           columns.Template(@<text></text>)
    .ClientTemplate("<input type='checkbox' class='checkBoxClass' data-bind='checked: fldGreenTag'/>")
    .Width(100);

    And within the DataBound event you need to bound the input elements to the model:
    function dataBound(e) {
        var grid = this;
        grid.element.find("[role='row']").each(function () {
            var tr = $(this).closest('tr');
            var item = grid.dataItem(tr);
            kendo.bind($(this), item);
        });
    }


    Best Regards,
    Konstantin Dikov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top