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

Grid (in Window) Custom Command is not calling JS function

1 Answer 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Omar
Top achievements
Rank 1
Omar asked on 24 Jun 2014, 06:59 PM
I have the following simple code which is the content of a Kendo Window:
<div id="nsdGird"></div>
 
<script>
 
    var model = @Html.Raw(Json.Encode(Model));
 
var grid = $('#nsdGird').kendoGrid({
    dataSource: model,
    pageable: true,
    sortable: true,
    scrollable: false,
    selectable:true,
    columns: [ {
                field: "Name",
                width: '150px',
                title: "NOTAM Name"
            } , {
                field: "Description",
            } , {
                command: {
                    text: "SelectNSD",
                    click: SelectNSD,
                    name:"Select-NSD"
                },
                title: "Select",
                width: '100px'
            } ]
}).data("kendoGrid");
 
var SelectNSD = function (e) {
 
    alert("Called");
    console.log(e);
 
}
 
</script>

the SelectNSD function is never called when I click on the custom command.  What is wrong with my code?

Thanks,

1 Answer, 1 is accepted

Sort by
0
CS
Top achievements
Rank 2
answered on 25 Jun 2014, 05:28 AM
First thing you could try is
command: {
                    text: "SelectNSD",
                    click: function (e) {
                                     alert("Called");
                                     console.log(e);
                          },
                    name:"Select-NSD"
                }
And Secondly, maybe you get a problem with the use of a function before it is defined, since you declared the SlectNSD after you used it in the Grid.
Tags
Grid
Asked by
Omar
Top achievements
Rank 1
Answers by
CS
Top achievements
Rank 2
Share this question
or