Class Index | File Index

Classes


Class LABKEY.ext.FormPanel


Extends Ext.form.FormPanel.

DEPRECATED - Consider using Ext.form.FormPanel instead.

LabKey extension to the Ext.form.FormPanel. This class understands various LabKey metadata formats and can simplify generating basic forms. When a LABKEY.ext.FormPanel is created with additional metadata, it will try to intelligently construct fields of the appropriate type.

If you use any of the LabKey APIs that extend Ext APIs, you must either make your code open source or purchase an Ext license.

Additional Documentation:


Defined in: FormPanel.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Constructs a new LabKey FormPanel using the supplied configuration.
Config Summary
Config Attributes Config Name and Description
 
If true, all fields specified in the metaData are automatically created.
 
as returned by LABKEY.Query.selectRows.
 
Alternate default container for queries (e.g.
 
If specified, form errors will be written to this element; otherwise, a MsgBox will be used.
 
If false, any lookup stores will be created immediately.
 
as returned by LABKEY.Query.selectRows.
 
as returned by LABKEY.Query.selectRows.
 
Provides initial values to populate the form.
Class Detail
LABKEY.ext.FormPanel(config)
Constructs a new LabKey FormPanel using the supplied configuration.
<script type="text/javascript">
    function onSuccess(data) // e.g. callback from Query.selectRows
    {
        function submitHandler(formPanel)
        {
            var form = formPanel.getForm();
            if (form.isValid())
            {
                var rows = formPanel.getFormValues();
                save(rows);
            }
            else
            {
                Ext.MessageBox.alert("Error Saving", "There are errors in the form.");
            }
        }

        function cancelHandler()
        {
            // Replace with real handler code
            Ext.MessageBox.alert("Cancelled", "The submission was cancelled.");
        }

        var formPanel = new LABKEY.ext.FormPanel(
        {
            selectRowsResults:data,
            addAllFields:true,
            buttons:[{text:"Submit", handler: function (b, e) { submitHandler(formPanel); }}, {text: "Cancel", handler: cancelHandler}],
            items:[{name:'myField', fieldLabel:'My Field', helpPopup:{title:'help', html:'read the manual'}}]
        });
        formPanel.render('formDiv');
    }
</script>
<div id='formDiv'/>
Parameters:
config
Configuration properties. This may contain any of the configuration properties supported by the Ext.form.FormPanel, plus those listed here. Also, items may specify a ToolTip config in the helpPopup property to display a LabKey-style "?" help tip. Note that the selectRowsResults object (see LABKEY.Query.SelectRowsResults) includes both columnModel and metaData, so you don't need to specify all three.
Config Detail
{boolean} config.addAllFields
If true, all fields specified in the metaData are automatically created.
Default Value:
'false'

{object} config.columnModel
as returned by LABKEY.Query.selectRows. See LABKEY.Query.SelectRowsResults.

{string} config.containerPath
Alternate default container for queries (e.g. for lookups)

{object} config.errorEl
If specified, form errors will be written to this element; otherwise, a MsgBox will be used.

{boolean} config.lazyCreateStore
If false, any lookup stores will be created immediately. If true, any lookup stores will be created when the component is created. (default true)

{object} config.metaData
as returned by LABKEY.Query.selectRows. See LABKEY.Query.SelectRowsResults.

{LABKEY.Query.SelectRowsResults} config.selectRowsResults
as returned by LABKEY.Query.selectRows.

{object} config.values
Provides initial values to populate the form.

Documentation generated by JsDoc Toolkit 2.3.2 on Tue Sep 11 2018 10:10:59 GMT-0000 (UTC)