Difference between revisions of "JavaScript Functions"
From AgileApps Support Wiki
imported>Aeric |
imported>Aeric |
||
Line 1: | Line 1: | ||
These functions are available anywhere that [[JavaScript]] is running on the platform. | These functions are available anywhere that [[JavaScript]] is running on the platform. | ||
==== | ====showTab==== | ||
Display an object list view as a tab in the GUI. | |||
;Syntax: | |||
:<syntaxhighlight lang="javascript" enclose="div"> | |||
showTab(); | |||
</syntaxhighlight> | |||
<!-- | |||
;Sample Usage: | ;Sample Usage: | ||
{{:JavaScript closeDialog Sample}} | {{:JavaScript closeDialog Sample}} | ||
--> | |||
====showTabInIFrame==== | |||
Display a record form as a tab in the GUI, using the form either to add a record to an object or to display record details. | |||
;Syntax: | |||
:<syntaxhighlight lang="javascript" enclose="div"> | |||
showTabInIFrame(); | |||
</syntaxhighlight> | |||
<!-- | |||
;Sample Usage: | |||
{{:JavaScript SQL Browser View Sample}} | |||
====lj_closeDialog==== | |||
Close the current dialog. Typically used in conjunction with [[#lj_refreshCurrentTab|<tt>lj_refreshCurrentTab</tt>]]. | |||
;Syntax: | ;Syntax: | ||
Line 11: | Line 31: | ||
lj_refreshCurrentTab(); | lj_refreshCurrentTab(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
;Sample Usage: | |||
{{:JavaScript closeDialog Sample}} | |||
====lj_printRecord==== | ====lj_printRecord==== | ||
This function displays a customized print dialog for a record. Use it to set defaults, to limit the available choices, and to choose the [[Print Template]] which is used. (It is only available for {{type|}}s.) | This function displays a customized print dialog for a record. Use it to set defaults, to limit the available choices, and to choose the [[Print Template]] which is used. (It is only available for {{type|}}s.) | ||
;Syntax: | ;Syntax: | ||
Line 61: | Line 69: | ||
| show_pdf || '''yes''' - allows user to choose HTML or PDF | | show_pdf || '''yes''' - allows user to choose HTML or PDF | ||
|} | |} | ||
;Sample Usage: | |||
This code adds a '''[Custom Print]''' button to a [[Form]], when placed in an On Load [[Form Script]]. In this case, the goal is to restrict a user who has access to that form to a specific template. (The standard Print operation makes all templates available. A standard [[Action]] button, meanwhile, is present in every form. This code puts the button in a specific form, to restrict template access for users whose role causes it to be displayed.) | |||
:<syntaxhighlight lang="javascript" enclose="div"> | |||
$("#print_button").remove(); | |||
$("#edit_button").parent().append( | |||
"<input type='button' id='customPrint' value='Custom Print' class='lj-button fg-button ui-state-default ui-corner-all' onClick=\"javascript:lj_printRecord('default_print_layout=template&show_print_layout=no&default_print_document=jsp&default_page_orientation=landscape&default_pdf=yes&show_pdf=no&print_immediately=yes');\">" | |||
); | |||
</syntaxhighlight> | |||
:;How it Works: | |||
::; <tt>$("#print_button").remove()</tt>: Remove the standard print button | |||
::; <tt>$("#edit_button").parent().append</tt>: Finds the location of the edit button (present in every form), gets it's parent (the toolbar), and adds the new button to it. | |||
::; <tt>class='lj-button fg-button ui-state-default ui-corner-all'</tt>: The standard CSS style elements for platform buttons. | |||
::; <tt><nowiki><input type='button' ...</nowiki></tt>: Define the button. (The entire string is one uninterrupted line.) | |||
::; <tt>onClick=\"javascript:lj_printRecord(...</tt>: Specify the button's action | |||
====lj_refreshCurrentTab==== | ====lj_refreshCurrentTab==== | ||
Refresh the current tab. Typically used in conjunction with [[#lj_closeDialog|<tt>lj_closeDialog</tt>]] | Refresh the current tab. Typically used in conjunction with [[#lj_closeDialog|<tt>lj_closeDialog</tt>]] | ||
;Syntax: | ;Syntax: | ||
Line 72: | Line 92: | ||
lj_refreshCurrentTab(); | lj_refreshCurrentTab(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
;Sample Usage: | |||
{{:JavaScript closeDialog Sample}} | |||
====lj_refreshTab==== | ====lj_refreshTab==== | ||
Refresh a specific tab. Typically used in conjunction with [[#lj_closeDialog|<tt>lj_closeDialog</tt>]] | Refresh a specific tab. Typically used in conjunction with [[#lj_closeDialog|<tt>lj_closeDialog</tt>]] | ||
;Syntax: | ;Syntax: | ||
Line 83: | Line 103: | ||
{window}.lj_refreshTab(); | {window}.lj_refreshTab(); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
;Sample Usage: | |||
{{:JavaScript closeDialog Sample}} | |||
====lj_showDialog==== | ====lj_showDialog==== | ||
This function displays a JSP/HTML [[Page]] as a dialog. | This function displays a JSP/HTML [[Page]] as a dialog. | ||
;Syntax: | ;Syntax: | ||
:<syntaxhighlight lang="javascript" enclose="div"> | :<syntaxhighlight lang="javascript" enclose="div"> | ||
Line 120: | Line 132: | ||
| title || Displayed in the banner of the dialog. | | title || Displayed in the banner of the dialog. | ||
|} | |} | ||
;Sample Usage: | |||
This sample displays a page at the specified URL in a popup dialog that has a close button. | |||
:<syntaxhighlight lang="javascript" enclose="div"> | |||
var url = "/networking/pages/MyPage.jsp?recordId="+someValue | |||
Β Β Β Β + "&returnUrl="+encodeURIComponent(lj_window_src); | |||
top.lj_showDialog(url,300,350,"popupdialogWithCloser","My Page Title"); | |||
</syntaxhighlight> | |||
<noinclude> | <noinclude> | ||
[[Category:JavaScript APIs]] | [[Category:JavaScript APIs]] | ||
</noinclude> | </noinclude> |
Revision as of 19:44, 28 December 2011
These functions are available anywhere that JavaScript is running on the platform.
showTab
Display an object list view as a tab in the GUI.
- Syntax
showTab();
showTabInIFrame
Display a record form as a tab in the GUI, using the form either to add a record to an object or to display record details.
- Syntax
showTabInIFrame();