Get selected row in server binding

4 posts, 0 answers
  1. Vince
    Vince avatar
    7 posts
    Member since:
    Apr 2013

    Posted 04 May 2013 Link to this post

    Hi, I trying to add a custom delete command on the toolbar and I need to get the selected row and data. I'm using Server binding and I tried using some of the answers in the forum but it still didn't work.

    function deleteCommand(e) {
        var grid = $('#reimbursementsGrid').data('kendoGrid');
        var rows =;
            function () {
                var record = $(this).data();
                alert('Selected : ' + record.Id);
    The alert is always showing undefined. Can someone please point me in the right direction please?

    The Id is defined in the model and is a hidden column
            .DataSource(dataSource => dataSource
                .Model(model =>
                    model.Id(r => r.Id);

            .Columns(columns =>
                columns.Bound(o => o.Id).Hidden(true);
  2. Vince
    Vince avatar
    7 posts
    Member since:
    Apr 2013

    Posted 06 May 2013 Link to this post

    Finally figured it out after searching like crazy. Here is my solution if others find it helpful.

    function deleteCommand(e) {
        var grid = $('#reimbursementsGrid').data('kendoGrid');
        var selectedRows =;
        var selected = $.map(selectedRows, function(item) {
                    var checked = $(item).find('.check-box').attr('checked');
                    return {
                        id: $(item).find(':nth-child(1)').text(),
                        expDate: $(item).find(':nth-child(2)').text(),
                        category: $(item).find(':nth-child(3)').text(),
                        amount: $(item).find(':nth-child(4)').text(),
                        miles: $(item).find(':nth-child(5)').text(),
                        submitted:  checked === "checked" ? true : false
        console.log( selected );
        console.log( selected[0].id );
        console.log( selected[0].category );
        console.log( selected[0].amount );
        console.log( selected[0].submitted );
    I'm not sure if its the preferred way but its working. I also had a checkbox column which I wanted to find out also if it was checked which is in the above solution in case others need as had to search to find this too.
  3. Galen Giebler
    Galen Giebler avatar
    13 posts
    Member since:
    Nov 2004

    Posted 19 May 2013 Link to this post

    THANKS SO MUCH for posting your solution.  You saved me from starting over and rewriting my solution!
  4. Stu
    Stu avatar
    6 posts
    Member since:
    Apr 2015

    Posted 20 Apr 2015 Link to this post

    Thanks very much for this solution.  I've been working on this for a couple days and your code worked great for me.
Back to Top