============
view_options
============

.. js:attribute:: view_options

**domain**: client 

**language**: javascript

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

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

The ``view_options`` attribute is a set of options that determine how the view  
form of will be displayed on the browser page.

These options are set in the
:doc:`View Form Dialog </admin/items/view_form_dialog>`
in Application Builder.

You can change view options in the 
:doc:`on_view_form_created <on_view_form_created>`
event handler of the item. See example.

``view_options`` is an object that has the following attributes:

=================== ============================================================
Option              Description
=================== ============================================================
width               the width of the modal form, the default value is 600 px

title               the title of the form, the default value is the value of a
                    :doc:`item_caption </refs/client/abstr_item/at_item_caption>`
                    attribute,
                    
form_border         if true, the border will be displayed around the form            

form_header         if true, the form header will be created and displayed
                    containing form title and various buttons
                    
history_button      if true and 
                    :doc:`saving change history is enabled </admin/saving_history>`, 
                    the history button will be displayed in the form header
                    
refresh_button      if true, the refresh button will be created in the form 
                    header, that will allow users to refresh the page by sending 
                    request to the server
                    
enable_search       if true, the search input will be created in the form header

search_field        the name of the field that will be the default search field

enable_filters      if true and there are visible filters, the filter button will 
                    be created in the form header

close_button        if true, the close button will be created in the upper-right 
                    corner of the form
  
close_on_escape     if true, pressing on the Escape key will execute the 
                    :doc:`close_view_form <m_close_view_form>`
                    method to close the form
  
view_details        the list of detail names, that will be displayed
                    in the view form, if view form template contains the div 
                    with class 'view-detail' (the default view form template have 
                    this div)
                    
detail_height       the height of the details desplayed in the view form,
                    if not specified the height of the detail table is 200px

modeless            if true, the form will be displayed as modeless

template_class      if specified, the div with this class will be searched in 
                    the task 
                    :doc:`templates </refs/client/task/at_templates>` 
                    attribute and used as a form html template when creating a 
                    form. This attribute must be set before the form is created
=================== ============================================================                    

Example
=======

.. code-block:: js

    function on_view_form_created(item) {
        item.view_options.width = 800;
        item.view_options.close_button = false;
        item.view_options.close_on_escape = false;    
    }

See also
========

:doc:`Forms </programming/interface/forms>`

:doc:`view <m_view>`