2022.2

Table Of Contents
Tip: MoreexamplesofhowtouseanAPItoloadexternalcontentaregivenintheseHow-to's:
l
UsingtheGoogleMapsAPI
l
UsingtheOpenWeatherMapAPI
Using scripts in Dynamic Tables
Ifthecontentsorstyleofcellsorrowsina"DynamicTable"onpage742needtobepersonalized
basedonthevalueofadatafield,youwillneedascript.
Doyouwanttostyleorchangetheoutputofanexpression,basedonthevalueofadatafield?Thena
customHelpercancomeinhandy.AHelperisafunctionthatcanbeusedinanexpression.Howtocre-
ateacustomHelperisdescribedinthetopic:"CreatingcustomHelpers"onpage771.Aftercreatinga
HelperyoucantypethatHelper'snameinanyexpression.
InallothercasesyouwillneedaStandardScript.
Thistopicgivessomeinformationthatwillhelpyoutowriteascriptfor(anelementin)aDynamic
Table.
Itisassumedthatyouarefamiliarwiththescriptingbasics;see"Writingyourownscripts"onpage808.
WritingscriptsforaDynamicTable
Ifyou'regoingtocreateyourownscriptsforDynamicTables,thereareafewthingsyouneedtoknow.
Selectors
Scriptsthattarget(anelementin)aDynamicTablecanusethesametypesofselectorsasother
scripts.Intheoutput,DynamicTablerowsarerepeatedincludinganyclassesthataresetontherow
andonitscontents.
Inaddition,DynamicTablesandtheirrowsandcellshavesomespecialdata- attributesthatcanbe
usedasselector.See:"ADynamicTable'sdata-attributes"onpage755.
Notehowever,thatthedata-repeatattributecannotbeusedasaselectorforStandardscripts,since
itgetsremovedwhenthetableisexpanded,whichhappensbeforeStandardscriptsrun.
Thedata-scriptattributeisusedifyoulettheDesignercreateascriptforyou(see"Quick-starta
scriptwiththeCreatescriptbutton"onthefacingpage).
How the scope of a script can simplify code
Itisrecommendedtosetthescopeofascriptthattargets(anelementin)dynamicallyaddedrowsto
Each matched element.
Theselectorofascriptthattargets(somethingin)arowthatislinkedtoadetailtablewillprobably
matchmultipleelements.
Page 835