Custom actions

Custom actions

MaikelMaikel Posts: 75Questions: 18Answers: 1

Hey, the editor has some default actions (new, edit, delete) but i would like to add some new actions here for my project (start, stop)

Is there a way to do this?

These new actions basically just update one field to a certain value.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    Not sure what the "certain value" is you want and where you are placing the start and stop buttons. In my case I wanted to do something similar where I have start/stop or on/off buttons in each row. These are checkboxes with added code to make them look like a toggle.

    My pages use Bootstrap so I use BootstrapToggle for this functionality. I believe there is at least one other Bootstrap toggle type extension available. If you are using Bootstrap you can look at this post for information on integrating BootstrapToggle with Datatables:
    https://datatables.net/forums/discussion/40032/bootstrap-toggle-plugin#latest

    Hope this is what you are looking for.

    Kevin

  • rduncecbrduncecb Posts: 125Questions: 2Answers: 28
    edited May 2017

    You can create all sorts of buttons for an editor. You just need to define it, and include a function to be called when it's clicked.
    See: https://editor.datatables.net/reference/type/button-options

    It's then a matter of making the function do what you need to do. You can tweak the data, call editor api methods like submit() etc.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Have a look at this example which does what you are looking for.

    Allan

  • MaikelMaikel Posts: 75Questions: 18Answers: 1

    great thanks a lot

  • fuscasoftwarefuscasoftware Posts: 1Questions: 0Answers: 0

    Is there a way to change the "action"-Value of the post data? I can't find anything.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Yes, use the preSubmit parameter, or ajax.data to modify the data that is being sent to the server.

    Allan

This discussion has been closed.