Modal popup in row with custom callback functions for buttons in popup
Modal popup in row with custom callback functions for buttons in popup

Hy,
I am looking how to solve following scenario:
1. user is looking at table(build by datatables )
2. user decides row is not needed anymore and click on button in chosed line(example: https://editor.datatables.net/examples/simple/inTableControls.html)
3. for security purposes I need user to repeat line ID that will be deleted
4. once delete button in popup is clicked I will redirect user to another page(not clear if I will do it in .NET, java or flask but basicaly I will redirect ot backend, do some work here and returned new view)...and this is what I am loooking for basically: how to add custom callback function to above mentioned example
Any help for this would be appreciated since I am stuck on this
Thanks!
Answers
Are you wanting to do this with Editor specifically? If so, you could use the
message()
method, ormessage
option ofform-options
to show a suitable message (since they allow HTML) - e.g.:Then use
preSubmit
to add that value to the Ajax request to the server so it can validate it (it must be done server-side since otherwise it would be trivial to bypass).Allan
Thnks for help.
No necessary in editor since Im using free version for now. I want to just have button where I define custom callback that redirects to backup with parameters from chosen line
But including row in popup message is not possible as I can see?
Sure - use
row().data()
to get the data for a given row. e.g. you could use:to get the data for a selected row. Or if you’ve got an event handler being triggered inside the row:
Allan
Thanks Allan. I just can't wrap my head around how to create button and modal dialog popup. Any examples for this?
If we take this example, in line 56 in the code shown below the table you could use:
Then you have all of the row’s data in
data
. So you could do:Obviously that is specific to that example, so you’d need to modify it a bit for your data. And I’ve assumed you are using Editor, but even if not then the techniques are the same but way to use the data will be different based on whatever you are using.
Allan