====================
create_filter_inputs
====================

.. js:function:: create_filter_inputs(container, options) 

**domain**: client 

**language**: javascript

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

Use ``create_filter_inputs`` to create data-aware visual controls (inputs, cheboxes) 
for editing 
:doc:`filters <at_filters>`
of the item.

This method is usually used in ``on_filter_form_created`` events triggered by
:doc:`create_filter_form <m_create_filter_form>`
method.

The following parameters are passed to the method:

* ``container`` - an JQuery object that will contain visual controls

* ``options`` - options that specify how controls are displayed

The ``options`` parameter is an object that may have following attributes:

* ``filters`` - a list of filter names. If specified, a visual control will be 
  created for each filter whose name is in this list, if not specified 
  (the default) then the fields attribute of an 
  :doc:`filter_options <at_filter_options>`
  will be used (by default it lists all visible filters specified in the 
  Administrator),

* ``col_count`` - the number of columns that will be created for visual controls, 
  the default value is 1.
  
* ``label_on_top``: the default value is false. If this value is false, the 
  labels are placed to the left of controls, otherwise the are created above the
  controls
  
* ``tabindex`` - if tabindex is specified, it will the tabindex of the first 
  visual control, tabindex of all subsequent controls will be increased by 1.
  
* ``autocomplete`` - the default value is false. If this attribute is set to 
  true, the autocomplete attribute of controls is set to "on"   

Before creating controls an application empties a container.

Example
=======

.. code-block:: js

    function on_filter_form_created(item) {
        item.filter_options.title = item.item_caption + ' - filter';
        item.create_filter_inputs(item.filter_form.find(".edit-body"));
        item.filter_form.find("#cancel-btn").on('click.task', function() {
            item.close_filter()
        });
        item.filter_form.find("#ok-btn").on('click.task', function() {
            item.apply_filter()
        });
    }

See also
========

:doc:`filters <at_filters>`

:doc:`create_filter_form <m_create_filter_form>`

:doc:`filter_form <at_filter_form>`

:doc:`filter_options <at_filter_options>`



