UBOS Community

Daniel
Daniel

Posted on

Button actions 'onClick'

The button has 15 different events onClick.

Image description

Execute a Query - this is the event where we can call our API that we created. When you click on this event, a small menu will open with already existing APIs, or options to create a new one.
Image description

Execute a JS function - here we call the function that is written in JS Object.
Image description

Navigate To - allows the user to navigate between the internal pages of the App or to an external URL. Enter the page name or the external URL in the navigateTo function, enter the Query parameters if required, and select the destination for the new page (a new window or same window).
Image description

Show message - it shows a temporary notification style alert message to the user. The message type can have Info, Success, Error, and Warning.
Image description

Open modal - this function is used to open a modal when triggered. Modal is in widgets.
Image description

Close modal - this action is used to close a modal when triggered. Create a new modal and open it before calling this action.
Image description

Store value - function saves data in the browser as key-value pairs and can be later accessed anywhere in the application. It data you can view if you go to the developer console in the browser and select localStorage.
Image description

Download - users have the ability to download a wide range of file formats. This action serves the purpose of downloading any data as a file. The feature is made possible by using downloadjs library.
Image description
Image description
Image description

Copy to clipboard - this function is used to copy text to the clipboard.
Image description

Reset widget - use the resetWidget function to revert a widget to its default state. Any user input changes will get reverted and the values in the default properties will be applied. For example, you can use it when you want to clean the form of inputs.
Image description

Set interval - executes a callback function with a fixed time interval between the calls.
Image description

Clear interval - stops a repeating callback that was started with the setInterval method.
Image description

Get Geolocation - this object contains functions to request the current user location and the coordinates received from this.
request
Image description

Watch Geolocation - almost similar to the original browser API, apart from the fact that you don't need to pass the success callback. On success, the location would automatically be stored at main.geolocation.currentPosition.coords with the main.geolocation.currentPosition.timestamp updated whenever the position was last updated. The callbacks, if provided, gets executed automatically when the location has changed. No watchId is returned as well as the platform only allow for a single watchPosition.
Image description

Stop watching Geolocation - stop and clearing your current geolocation. For stopping you don't have to pass the watchId. If a watch is active, you must clear it before starting a new one by calling this function.
Image description

Discussion (0)