> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# Method name: columns()

# Method package: w

# Method menu location: w --> Table --> columns

# Method Link: https://dev.wix.com/docs/velo/velo-only-apis/$w/table/columns.md

# Method Description:

Sets or gets the defining properties of the columns in a table.

Table columns do not store any data. They contain the
 properties, such as the `label` and `type`, that define a table column.

 Setting the `columns` property sets the columns
 in the table.

 Getting the `columns` property returns the current
 list of columns in the table.

 You cannot modify the data array in-place. To add, change, or remove
 individual columns:

   1. Store the value of the `columns` property in a variable.
   1. Make changes to the columns array.
   1. Reset the `columns` property with the modified array.



# Method Code Examples:

*** Note: do not assume any prop names or enum values other than the ones in the example.

## Get the list of columns and the first column's information

```javascript
let cols = $w("#myTable").columns;

let firstColID = cols[0].id;              // "col0"
let firstColDataPath = cols[0].dataPath;  // "first_col"
let firstColLabel = cols[0].label;        // "First Column"
let firstColWidth = cols[0].width;        // 100
let firstColVisible = cols[0].visible;      // true
let firstColType = cols[0].type;          // "string"
let firstColPath = cols[0].linkPath;     // "link-field-or-property"
```

## Set the list of columns for a table

```javascript
$w("#myTable").columns = [
  {
    "id": "col1",
    "dataPath": "field1",
    "label": "Field 1",
    "width": 100,
    "visible": true,
    "type": "string",
    "linkPath": "link-field-or-property"
  },
  {
    "id": "col2",
    "dataPath": "field2",
    "label": "Field 2",
    "width": 100,
    "visible": true,
    "type": "image",
    "linkPath": "link-field-or-property"
  },
  {
    "id": "col3",
    "dataPath": "field3",
    "label": "Field 3",
    "width": 100,
    "visible": true,
    "type": "number",
    "linkPath": "link-field-or-property"
  }
];
```

## Add a column to a table

```javascript
let cols = $w("#myTable").columns;
cols.push( {
  "id": "newCol",
  "dataPath": "new_col",
  "label": "New Column",
  "width": 100,
  "visible": true,
  "type": "string"
} );
$w("#myTable").columns = cols;

```

---