a existing element or a string that will find a element by id
html code for creating new elements
the first of the created elements or undefined if none created
Change the color of the button by first remove all btn- + primary, danger, warning, success and info classes then add the new class or classes and change the text if you want as well
buttonid or button to change
array classes or a single class string to remove extra
array classes or a single class string to add
Optionaltext: string
to be added to button instead of the one already there if parameter used
Clear the error element defined by errorid if active defined by errortoelement
Create new element from html code
html code
elements created from the html
Create a checkbox with a changable class set that can be used for event that will be used for select and deselect single or all depening on the value set
function needed to be implemented is onchangecheckbox(event)
Optionalvalue: string
if not set use path as value
Do a DELETE request to the url and return the json object
an url that is allowed to use
a real object from call to server or a {result: 'error', error: message}
Do a GET request to the url and return the json object
an url that is allowed to use
a real object from call to server or a {result: 'error', error: message}
Do a POST request to the url and return the json object
an url that is allowed to use
a object that will be stringified to send
a real object from call to server or a {result: 'error', error: message}
Do a PUT request to the url and return the json object
an url that is allowed to use
a object that will be stringified to send
a real object from call to server or a {result: 'error', error: message}
Find one HtlmElement
a existing element or a string that will find a element by id
Optionalselector: string
uses to find a element inside the element found by elmid
HtmlElement or null
Add or remove color classed on an element. Used to change colors to elements that have a prefix. Ex. btn-danger or text-success The prefix will be added to any classes given if no - in class name so you can use warning instead of btn-warning on a button
By default primary, danger, warning, success and info is always removed before any add
element id or the element to change
A prefix to use for the classes like btn-
array of classes or single class to remove or undefined if not used, if no - in name prefix will be added
array of classes or single class to add or undefined if not used, if no - in name prefix will be added
Optionaltext: string
to be added to button instead of the one already there if parameter used
Get 0 or more elements from selector(s) or element and selector
existing element to be queried for children or a selector for selecting elemenets
Optionalsel2: stringlist of Elements or null
Find attribute on element or on the first child that have this attribute and return the value
an existing element or a string that will find a element by id
name of the attribure to find
attribute or null
element id or the element to start from
a name of html type in lower case
array of two elements where the first is the element matching the localname type or null and the second how many levels up from the start did we have to go
function tablecellonclick(event){
const [td, level] = this.findfirstparentoftype(event.target, 'td');
if (td){
// ... do something with table cell
}
}
will find first td up in tree from the event.taget calling it
Check for attribute on element or children and return the first element having the attributre defined
an existing element or a string that will find a element by id
name of the attribure to find
element with attributre defined or null
Return a attribute value if it exists
an existing element or a string that will find a element by id
attribute name
attribute value or blank string
Return a attribute value if it exists
an existing element or a string that will find a element by id
attribute name
if set to true a null will be returned for not found
attribute value or blank or null depending on nullonnotfound
Hide a element by adding d-none class
an existing element or a string that will find a element by id
the element or null
Get inner htlm to or from a element
a existing element or a string that will find a element by id
the inner htlm of the element or null if element not found
Set inner htlm to an element
a existing element or a string that will find a element by id
if given a string, it will be set to the element
null if element not found or the element if code set
Test if a instance is a real array and not object or null
to test
true if real array
Give to strings in the form of semantic versioning and tell if the first is newer than the second Support any type version as long as they are seperated by the same number of . Ex. 0.1.0 and 0.1.1 gives false Ex. 9.0.0.2992 and 9.0.0.2990 gives true Ex. 9.1.0.0 and 9.0.0.2990 gives true as well
version to check
version to check against
true or false
Test if a instance is a real object and not array or null
to test
true if real object
Call a method when element selected is changed
an existing element or a string that will find a element by id
a method in the class extended on this class
Call a method when element selected is clicked
an existing element or a string that will find a element by id
a method in the class extended on this class
Call a method when element get the named event. This method if for handleing all events that not are so commonly used that they have got their own method like onclickme
an existing element or a string that will find a element by id
the name for the event to register ex input, focusin, focusout
a method in the class extended on this class
Call this function when document have finished loading
a function to run
Remove children from the back of thil element till there is only the amount of to left
an existing element or a string that will find a element by id
Optionalto: number
hove many children to be left, default is 0 if not set
Add a class to all selected elements
a selector that will match elements in the DOM
class name to add
Remove class from all selected elements
a selector that will match elements in the DOM
class name to remove
Send error to console and error element if defined To error element is defined by errorid and errortoelement To console is defined by errortoconsole
the result from call to deserver api or a string
Set a attribute value on a element or if value is null, remove it
an existing element or a string that will find a element by id
attribute name
a string value to set or null if you want to remove the attribute
element if found and attribute set or null if element not found or remove failed
Used by showerror for displaying a error dialog and to avoid a lot of extra code in the budlels we prefer to set it dynamically after creation of guitools. What is used is for now is bootstap.Modal
the bootstrap element set in window.bootstrap when loading bootrap.js in browser
For make a part of the page adjust to the resizing of the app
element id or the element to resize
Optionaladjust: number
default if 40 px at the bottom is left, you can use a different number by adding it here
Show a element by remove d-none class
an existing element or a string that will find a element by id
the element or null
Show the error modal that should be defined in the html a id="ErrorModal" Needs to be async to be able to dynamically load bootstrap if not already done
The title on top of error
The error message in dialog, can be text or html
Optionaladdcancelchain: boolean
show the chain cancel button or not
Change the color of the text by first remove all text- + primary, danger, warning, success and info classes then add the new class or classes and change the text if you want as well
element id or the element to change
array classes or a single class string to remove extra
array classes or a single class string to add
Optionaltext: string
to be added to button instead of the one already there if parameter used
Get value from element
an existing element or a string that will find a element by id
return the value of element as string or boolean if the element exists and null if not
Set value in element
an existing element or a string that will find a element by id
this is the value to set
it will return undefined if a value is set and null if element do not exist
Append children created by html code to the end of the selected element