⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Showing what rows will be affected during delete action instead of a confirmation dialog box



PunkMaster

PunkMaster
  • profile picture
  • Member

Posted 20 August 2013 - 08:05 AM

Hi Everyone 

 

Am developing a content management system with grocery crud. What am looking for is to have a custom confirmation box which shows pages/menu or section that will be deleted if a user tries to delete a parent record that has one or more child record in a database. 

 

Consider the scenario where you have  a product page with child page like product one, product two, and so forth. Then i want  the delete confirmation box to show something like "you're about to delete product page which will automatically delete product one page, product two page... and if a user click OK it does what it says 

 

Anyone with an idea would be much appreciated 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 20 August 2013 - 10:24 AM

Well you have to take control of the delete button .. and before it can perform the delete, you can make a call to the underlying ajax function to retrieve the related data / content and then prompt user for confirmation on the same. That is how you can set it with ease.

If you do not wish to take control of the default functional delete button ... then unset the delete action and there you just add your own delete button which on click makes a call to javascript function .

and this u can define it in a javascript file and add to crud by set_js

 

Hope the solution works out for you


davidoster

davidoster
  • profile picture
  • Member

Posted 21 August 2013 - 10:27 AM

The same can be achieved with callback_delete.

It's only a matter of preference which one somebody might use.


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 21 August 2013 - 15:19 PM

True ... very true :)