set kendo grid jquery command dynamic

18 views Asked by At

I have a simple grid just have two columns, the first column is name, second column is the command column. Is there a way to set the command column dynamic? For example, if the last name is "doe" then display both "edit" and "delete" button, otherwise, only display "edit" button.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
  columns: [
    { field: "name" },
    { command: ["edit", "destroy"] } // displays the built-in "edit" and "destroy" commands
  ],
  editable: "inline",
  dataSource: {
    data: [ {Id: 1, name: "Jane Doe" },{Id: 2, name: "Emily Doe" }, {Id: 3, name: "Emily White" }],
    schema: {
      model: {
        id: "Id",
        fields: {
          name: { type: "string" }
        }
      }
    }
  }
});
</script>
0

There are 0 answers