1. JSFormToolbar

    Article: AN0001717Updated: 10.11.2018

    Object for work with toolbar in the form.

    Object properties

    Name Description
    void Clear() Method clears buttons in the toolbar.
    void AddControl(string id, ToolbarButton tb) Method adds a button to the toolbar.
    ToolbarButton GetButton(string id) Function returns button according to the input Id.
    ToolbarButton CreateButton( string id, string text, string imageUrl) Function creates button and adds in to the toolbar.
    HyperLinkButton CreateLinkButton( string id, string text, string imageUrl, string url, string target) Function creates button s odkazem and adds it to the toolbar.
    ToolbarButton CreateDeleteButton( string id) Function creates button Delete and adds it to the toolbar.
    ToolbarButton CreateReloadGridButton( string id) Function creates button Reload and adds it to the toolbar.
    ToolbarButton CreateSaveButton( string id) Function creates button Save and adds it to the toolbar.
    HyperLinkButton CreateBackButton(string id, string url) Function creates button Back and adds it to the toolbar.
    HyperLinkButton CreateNewButton(string id, string url) Function creates button New and adds it to the toolbar.

    ToolbarButton is a button in the toolbar, on which user can click and this event can be captured and processed by means of script.

    HyperlinkButton is a button, which redirects user to the defined page after clicking.

    Functions Create_xxx_Button create button, set a text and icon, but you have to take care of handling of the click yourself by means of a script. These functions only facilitate creation of often used buttons.

    In order to handle the click you have to create a function with name ID_CLICK in the script, where ID is the id of the button that you defined at the time of its creation.

    Example

    Example for seting up Back to another page.

    var b = OGForm.GetControl('backToolbarButton');
    b.Visible = true;
    b.Text = 'My Back to start';
    b.NavigateUrl = 'Datas.aspx?CId=407';

     

    Example of adding a button to the toolbar and its handling. Add this script between the script for class detail for record detail.

    function OnLoad()
    {
      OGForm.Toolbar.CreateButton('mybutton', 'MyButton', 'images/system/new.png');
    }

    function mybutton_Click()
    {  
      OGForm.SetInfo('Click on my button');
    }

×