getCurrentItem( )


Returns the current item.

The getCurrentItem() function returns an object whose key:value pairs are the field IDs and field values of the current item, including all hidden fields. Fields that do not have a value are omitted from the returned object.

When called on a write-only or read & write dataset, getCurrentItem() returns the unsaved state of the current item.

Returns null or undefined if the dataset:

  • Is filtered to not match any items in the collection.
  • Is empty.
  • Has not loaded yet.

Note:

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.

To call 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 onRowSelect or onClick, to call getCurrentItem() because they will fire before the dataset's current item is updated.

Method Declaration
Copy
Request
This method does not take any parameters
Returns
Return Type:object
Was this helpful?
Yes
No