Add custom export button based on row selections

Add custom export button based on row selections

klinglerklingler Posts: 54Questions: 25Answers: 1

Good morning

The editor allows me to add a custom button besides the create/edit/delete....
Now is it possible to add a custom button based on row selection(s)?

I use datatables with editor for an internal ordering tool where each row shows an excel icon for exporting that particular order as CSV.

But it happens from time to time that several people order from the same company, so I need something like to add a custom export button when a user selects the orders from the same company with the checkboxes.

Principle would be like:

  • select just one order -> show export button
  • select several orders with the same supplier id in a column -> show export button
  • select orders from with different supplier id in column -> don't show or gray out/disable export button

Is this something that can be done?

thanks in advance
richard

Answers

  • kthorngrenkthorngren Posts: 14,174Questions: 25Answers: 3,343

    There are a bunch of Buttons APIs to choose from. You can use ``-api button().add()and-api button().remove()or-api button().enable()or-api button().disable()depending on your needs. You can use the-event selectand-event deselect` events to determine what is selected then use one of the buttons APIs to do what you need.

    Kevin

Sign In or Register to comment.