This is a migrated thread and some comments may be shown as answers.

[Solved] MVC Grid column context menu not firing change event when checked

1 Answer 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Siva
Top achievements
Rank 1
Siva asked on 28 Feb 2012, 10:11 AM
Hi,

I have a Telerik MVC Grid.
I am handling client side event for Column Selection Context Menu Change event to show or hide columns
Below is the code.

var unCheckedList = new Array();
    $(document).delegate("#ClaimsGrid_contextMenu [type=checkbox]", "change", function () {
        var index = $(this).data("field");
        var column = $("#ClaimsGrid").data("tGrid").columns[index];
        alert($(this).is(':checked'));
        
        if (!$(this).is(':checked')) {
            alert("UnChecked");
            if ($.inArray(column.member, unCheckedList) == -1)
                unCheckedList.push(column.member);
        }
        else {
            alert("Checked");
            $.each(unCheckedList, function (idx, value) {
                if (value == column.member) {
                    unCheckedList.splice(idx, 1);
                }
            });
        }
    });

The code works fine if I uncheck a column. But the event is not fired when I check a column that I previously unchecked.

Appreciate any help in this regard.

Thanks,
Siva

1 Answer, 1 is accepted

Sort by
0
Siva
Top achievements
Rank 1
answered on 28 Feb 2012, 10:49 AM
Hi,

My bad.. it was a jquery issue. I just needed to handle column selection context menu checkbox "click" event rather than "change" event as mentioned in my previous post.
I am receiving both check and uncheck events now

Regards,
Siva
Tags
Grid
Asked by
Siva
Top achievements
Rank 1
Answers by
Siva
Top achievements
Rank 1
Share this question
or