================
disable_controls
================

.. js:function:: disable_controls()

**domain**: client 

**language**: javascript

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

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

Call ``disable_controls`` to "turn off" data-aware controls, so they will not refrect 
changes to the item dataset data.

Call 
:doc:`enable_controls <m_enable_controls>` 
to re-enable data display in data-aware controls associated with the dataset.

Call
:doc:`update_controls <m_update_controls>` to tell associated controls to redraw
to reflect current data.

Example
=======

.. code-block:: js

    function calculate(item) {
        var subtotal,
            tax,
            total,
            rec;
        if (!item.calculating) {
            item.calculating = true;
            try {
                subtotal = 0;
                tax = 0;
                total = 0;
                item.invoice_table.disable_controls();
                rec = item.invoice_table.rec_no;
                try {
                    item.invoice_table.each(function(d) {
                        subtotal += d.amount.value;
                        tax += d.tax.value;
                        total += d.total.value;
                    });
                }
                finally {
                    item.invoice_table.rec_no = rec;
                    item.invoice_table.enable_controls();
                }
                item.subtotal.value = subtotal;
                item.tax.value = tax;
                item.total.value = total;
            }
            finally {
                item.calculating = false;
            }
        }
    }

See also
========

:doc:`Data-aware controls </programming/interface/data_controls>`

:doc:`enable_controls <m_enable_controls>` 

:doc:`update_controls <m_update_controls>`

