1. Data type JSDataDetailForm

    Article: AN0001712Updated:

    This object is used for work with a detailed form on page with record detail (e.g. DataDetail.aspx). In this way you can save the form from the script, reload it again, check, if the user can perform saving the data etc.

    Object properties

    Name Description
    bool CanSave() Function finds out, wheather the user can save the record.
    bool CanDelete() Function finds out, wheather the user can delete the record.
    void CreateNew() Method creates a new entity and displays it in the form.
    void Delete() Method deletes record displayed in the form.
    bool LoadById(int id) Function reads a record according to the input ID. If the record exists, True is returned. Otherwise false.
    EntityFormMode Mode Property returns form mode.
    bool ReadOnly Indication, wheather the form is in ReadOnly state.
    void RecreateColumns() Method creates again columns in the form.
    void Reload() Method reads the record again.
    void Save() Method saves the displayed record.
    void Save(bool afterCallRedirect)

    Method saves the displayed record.

    When afterCallRedirect = true, redirection occurs after the save operation, that happens after clicking on the button Save in the toolbar.

    void Save(bool afterCallRedirect, Hashtable dataRowProperty)

    Metoda uloží zobrazený záznam. Ve vlastnosti dataRowProperty můžete předat hodnoty, které budou nastaveny do ukládaného záznamu.

    Při afterCallRedirect = true dojde po zpracování uložení k přesměrování, ke kterému dochází po kliknutí na tlačítko Uložit na toolbaru.

    void SaveTask() Method saves the record like workflow task completion.
    void SaveTask(Hashtable dataRowProperty) Metoda uloží záznam jako ukončení úkolu workflow. Ve vlastnosti dataRowProperty můžete předat hodnoty, které budou nastaveny do ukládaného záznamu.
    bool ShowApproveTaskPanel Indication, wheather panel for workflow task saving shall be displayed in the form.
    EntityFormMode EntityFormMode_Normal Normal mode of detailed form.
    EntityFormMode EntityFormMode_MultiChange Multiple change mode of detailed form.
    EntityFormMode EntityFormMode_Archive Archive mode of detailed form.

    Task saving

    The Method SaveTask performs saving of the record from the form like workflow task completion. If the record is not a task or the task is already completed, nothing will happen.  This method shall be used together with indication ShowApproveTaskPanel for own task completion handling.

    In case, you want to handle saving on your own, disable displaying standard panel for task completion, insert a button on the toolbar and complete the workflow task including execution of your other code from this button.

    Saving with setting up records parameters

    In case there is column, value of which you want to set with script (e.g. on a button), not displayed in a form, use methods Save or SaveTask with parameter dataRowProperty. Set values in this parameter, that will be copied into the saved record.

    Examples

    Saving a record

    OGDataDetailForm.Save();

    Saving record with value setting

    This example sets value 1 in coloumn approval.

    var ht = OG.CreateHashtable();
    ht['approval'] = 1;
    OGDataDetailForm.Save( ht);

    Example of setting up values into form controls and its save

    var colStatus = OG.Column.GetByCode( OGActualDataRowParentId, 'status');
    var colAssignto = OG.Column.GetByCode( OGActualDataRowParentId, 'assignto');

    //set status for release (id = 18)
    OGForm.GetControl(colStatus.Id).SetData( 18);

    //assign to user(id = 24)
    var pi = OG.Person.CreatePersonInfo( 24);
    OGForm.GetControl(colAssignto.Id).SetData( pi);

    OGDataDetailForm.Save();

     Hiding the panel for task completion

    In order to hide the panel for a standard workflow task completion call the following script in the event OnLoad on page DataDetail.aspx:

    OGDataDetailForm.ShowApproveTaskPanel = false;

     

×