Add button in datatable

Hello,

Can I add an extra button in a datatable (next to the "+add new record" button). I like to call a working function to sort the datatable.

Thank you,

Daniël

Hello @danieljr,

I'm sorry for the delayed reply.

You can add a new button to the DataTable toolbar using this code:

fd.control('DataTable1').widget.setOptions({  
  toolbar: [
    { name: "create" },
    {
      name: "New",
      text: "Button Text",
      click: function(e){
        //your function
        return false;}
    }
  ]
})

Correction from reply by mail from Margarita Nikitina**

Hello Daniel,

Indeed nothing happens.

Try out this code:

fd.control('DataTable1').widget.setOptions({ toolbar: [
{ name: "create" },
{
name: "New",
text: "Button Name"
}
]
})

$(fd.control('DataTable1').$el).find(".k-grid-toolbar").on("click", ".k-grid-New", function (e) { alert("it's work") ;});

---
Kind regards,
Margarita Nikitina
Plumsail team

1 Like