Utility Functions
callFunction(fnString) ⇒ Object
ObjectCalls and executes the provided function's name without parameters.
Kind: global function
fnString
String
The function's name
dateToString(date) ⇒ String
StringConvert a Date object to the SIK string-date with formar "YYY-MM-DD HH:MM:SS.MMS". Sample: "2022-09-09 09:40:43.226". The Silk ORM returns and received date data in this format.
Kind: global function
date
The Date object to be converted
doesFileExist(urlToFile) ⇒ Boolean
BooleanVerifies is the URL of a resource file exist or is accesible in host server.
Kind: global function
urlToFile
The file' URL.
downloadText(content, contentType, fileName)
Function to download the provided text into a file.
Kind: global function
content
String
The text to download
contentType
String
The content type to download
fileName
String
Name of the file
escapeHtml()
Escapes HTML to be displayed with in a div.
Kind: global function
getFormattedValue(value, formatter) ⇒ String
StringFormats the value to specify pattern.
Kind: global function
value
Object
The value to get formated
formatter
String
The formating pattern or template
getNumber(value, precision) ⇒ Number
NumberConverts any provided value into a number.
Kind: global function
value
The value to be converted to a number.
precision
2
The decimal places.
getObjectType(obj) ⇒ String
StringReturn the type of the object.
Kind: global function
obj
The object to evaluate.
getRandomColor() ⇒ String
StringReturns the HEX value of ransom color.
Kind: global function
getTemplateData(template, index, item, renderer) ⇒ String
StringReplaces the columns, enclosed with "{" or ""{{", found in a provided template with the attributes found in the the provided item. Then apply a renderer if provided. Some templates: {row-index} - Renders the row number starting with 1. Usually use to display the row number in a table. {dp-inded} - Renders the data provider index used when building the row. {ms-value} - Render the current milliseconds. Usually used as a unique variable when displaying images.
Kind: global function
template
String
The string containing the columns to replace.
index
Integer
The index position in the list
item
Objet
The object containing the attributes to be used to replace.
renderer
String
The function to be used as data renderer.
getToday() ⇒ Date
DateReturn the current date and time
Kind: global function
getTodayString()
Return the current date and time in silk's string format.
Kind: global function
getUUID() ⇒ String
StringGenerates a UUID Value.
Kind: global function
ifTag($container)
Evaluates HTML tags for silk-if css classes in the provided JQuery object. If tags found evaluates the attribute data-if criteria to keep or remove the tag.
Kind: global function
$container
Object
JQuery object to evaluate. if undefined evaluates all the html document
ifUndefined(value, option) ⇒ Object
ObjectAnalyzes if the provided value is undefined or null. If tyes it return the provided option.
Kind: global function
value
The value to evaluate.
option
The option to return if the value is undefined or null.
inIframe() ⇒ Boolean
BooleanVerifies if a web application is running inside an iframe
Kind: global function
isEmpty(object) ⇒ Boolean
BooleanReturns true if the object is undefined or null or empty.
Kind: global function
object
The object to evaluate.
isIn() ⇒ Boolean
BooleanFunction to verify if the first parameter matches the other parameter values. The second parameter can be an array. It is not extrict compparizon.
Kind: global function
isNotEmpty(object) ⇒ Boolean
BooleanReturns true if the object is not undefined or null or empty.
Kind: global function
object
The object to evaluate.
isNumeric()
Return if the string is a number
Kind: global function
isRunningStandalone() ⇒ Boolean
BooleanVerifies if the web application is running standalone (PWA)
Kind: global function
left(str, n) ⇒ String
StringReturns a string with the provided number of characters starting from the left.
Kind: global function
str
The string to operate
n
The number of character to return
postToService(serviceURL, data, handleFunction)
Excutes a jQuery ajax post/json call to the provided URL. The handle function received the parameter result, which can be true or false, and the response data.
Kind: global function
serviceURL
String
The URL to the target service
data
Object
The data to be submited
handleFunction
function
The functin which will received the response.
renderCode() ⇒ String
StringTakes code text and replaces the tabs with hard spaces and in lines.
Kind: global function
String
The code to format
replaceAll(target, search, replace) ⇒ String
StringFunction replaceAll to replace all the existing string to a new one.
Kind: global function
target
The text to operate
search
The text to search
replace
The replacement text
right(str, n) ⇒ String
StringReturns a string with the provided number of characters starting from the right.
Kind: global function
str
The string to operate
n
The number of character to return
roundNumber(value, precision) ⇒ Number
NumberRounds a number to the provided decimal place
Kind: global function
value
The number to be rounded.
precision
0
The rounding decimal place.
sanitize(text) ⇒ String
StringCleans data from HTML tags.
Kind: global function
text
String
The text to sanitize.
stringToDate(stringDate) ⇒ Date
DateConvert a SILK string-date data to data object. The string should have the formar "YYY-MM-DD HH:MM:SS.MMS". Sample: "2022-09-09 09:40:43.226". The Silk ORM returns and received date data in this format.
Kind: global function
stringDate
The SILK string-date value to be converted.
Last updated

