Returns the current item.
getCurrentItem() function returns an object whose key:value pairs
are the field keys and field values of the current item, including all
hidden fields. Fields that do not have a value are omitted from the
When called on a write-only or read & write dataset,
getCurrentItem() returns the unsaved state of the current item.
undefined if the dataset:
- Is filtered to not match any items in the collection.
- Is empty.
- Has not loaded yet.
A dataset needs to load its data before you call its
getCurrentItem()function. Usually a dataset finishes loading a short time after the page it is on finishes loading. So if you call
getCurrentItem()inside the page’s
onReady()event handler, the dataset might not be ready yet.
getCurrentItem()as soon as possible after a page loads, use the dataset's
onReady()function inside the page’s
onReady()event handler to ensure that both the page and the dataset have finished loading.
If the current item is changed from a non-dataset source, such as by selecting a row in a table connected to a dataset or clicking a button set to advance to the next item in a dataset, the dataset's current item is not updated immediately. Therefore, to get the dataset's new current item, call
getCurrentItem()in the dataset's
onCurrentIndexChanged()event handler. Do not use the events of the non-dataset source, such as
onClick, to call
getCurrentItem()because they will fire before the dataset's current item is updated.
function getCurrentItem(): Object
This function does not take any parameters.
The current item, or null if there is no current item.
Was this helpful?