==========
can_delete
==========

.. js:function:: can_delete()

**domain**: client 

**language**: javascript

**class** :doc:`Item </refs/client/item_api>`

Description
===========

Use ``can_delete`` method to determine if a user have a right to delete a record of 
an item dataset.

This method takes into account the user permissions set in the :doc:`roles node </admin/roles>`
in the Application Builder when the project 
:doc:`safe mode parameter </admin/project/parameters>`
is set as well as the values of the 
:doc:`permissions <at_permissions>` 
attribute and the value of
:doc:`can_modify <at_can_modify>` attribute.

Example
=======

.. code-block:: js

    if (item.can_delete()) {
        item.view_form.find("#delete-btn").on('click', 
            function() {
                item.delete_record();
            }
        );
    }
    else {
        item.view_form.find("#delete-btn").prop("disabled", true);
    }
