JavaXT
|
|||||||||||||||||||||||||||||||||||
utils ClassCommon functions and utilities used by the webcontrols
ConstructorsThere are no public constructors.EventsonRender( el, callback ) Used to check whether DOM element has been added to the document. Calls a callback if it exists or when it is added. Public Methodsget( url, config ) Used to execute an HTTP GET request. Example:
get(url + "?filter=" + encodeURIComponent(filter), { success: function(text){ var arr = JSON.parse(text).records; }, failure: function(request){ alert(request.status); } });
getParameter( name, url ) Returns the value of a given parameter name in a URL querystring
merge( settings, defaults ) Used to merge properties from one json object into another. Credit: https://github.com/stevenleadbeater/JSONT/blob/master/JSONT.js diff( obj1, obj2 ) Used to compare 2 json objects. Returns a json object with differences. Credit: https://stackoverflow.com/a/13389935/ isArray( obj ) Used to check whether a given object is an array. Note that this check does not use the "instanceof Array" approach because of issues with frames. isDate( d ) Return true if a given object can be parsed into a date. Returns false if the object is a number (e.g. "3", "1.2") setStyle( el, style ) Used to set the style for a given element, replacing whatever style was there before.
addStyle( el, style ) Used to add style to a given element.
hasStyleRule( selector ) Returns true if there is a style rule defined for a given selector.
addNoSelectRule( ) Inserts the "javaxt-noselect" class into the document if it is not present. createElement( type, obj, style ) Used to create a DOM element
createTable( parent ) Used to create a table element.
getSuggestedColumnWidths( records, pixelsPerChar ) Used to analyze a given dataset and suggest column widths for a table or a datagrid
updateDOM( ) Used to update the default befaviour of the browser to prevent things like right mouse click, scrolling beyond a page, and drag and drop. getZScores( values, normalize ) Returns z-scores for a given set of values
addResizeListener( element, fn ) Used to watch for resize events for a given element. Credit: http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/ getHighestElements( obj ) Returns an array of elements at the highest z-index in the document getNextHighestZindex( obj ) Returns an integer represeting the highest z-value of all the DOM elements that appear with the given object + 1 |