Example page for Deletr class
Animated AJAX record deletion using Prototype and script.aculo.us
Click on the "delete" link for any record below to see the effect. For the sake of this example, records are not actually deleted from the database.
Deletr automatically attaches itself to all links with the class 'deletr'. On click on one of these links Deletr stops the event that's fired and takes command.
It does a get request to the url in the href attribute of the link that was clicked. After that the parent node of the link is hidden using two script.aculo.us effects.
There are currently five options one can use to adjust the behaviour of Deletr:
- parentNodeType: Type of the parent node. Defaults to 'tr'
- useCheck: Must the user confirm the deletion? Defaults to 'true'
- checkText: The text used in the confirmation popup. Defaults to 'Do you really want to delete this record?'
- startColor: Start color for the highlight effect. Defaults to '#fb6c6c'
- endColor: End color for the highlight effect. Defaults to '#ffffff'
Additionally to that, you can adjust the confirmation setting for each link by setting the option to 'false' and adding the 'deletr-check' class to each link that needs confirmation.
If set, the title attribute of the link will be used as text for the confirmation popup.