# Javascript: TableBaseCollection.getItem Method

> Gets the first table in the collection with the given id.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** TX Text Control .NET Server > Reference > JavaScript API > Javascript: TableBaseCollection.getItem Method
- **422 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tablebasecollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tablebasecollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tablebasecollection/getitem-method/llms-full.txt

---

### Description

Gets the first table in the collection with the given id.

### Syntax

```javascript
<void> TableBaseCollection.getItem(<RequestTableCallback> callback, [<ErrorCallback> errorCallback], <number> id)
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the requested table or null if there is no table at the current input position / with the requested id. |
| errorCallback | Optional. Is called when the operation failed with an error. |
| id | The table's identifier. |

### Examples

The following example demonstrates `TableBaseCollection.getItem` in a practical document-editing workflow. It gets the first table in the collection with the given id.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectItem(tableBases) {
    tableBases.getItem(
        function(table) {
            if (!table) {
                console.warn("No table was returned.");
                return;
            }
            
            console.log("get item result:", table);
        },
        onTxError,
        25
    );
}
```

---

## Nearby

- **Previous:** [TableBaseCollection Object](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tablebasecollection/llms-full.txt)
- **Next:** [Javascript: TableBaseCollection.removeAtInputPosition Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/javascript/tablebasecollection/removeatinputposition-method/llms-full.txt)
