An open API service indexing awesome lists of open source software.

https://github.com/malbernaz/vue-data-table


https://github.com/malbernaz/vue-data-table

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# Vue Data Table

## Documentation

### `DataTable`

```html

```

#### Props:

##### `defs`

The prop defs is an array of column definitions. Each column definition must have the following shape:

```ts
export interface ColumnDef {
// the column name
name: string;
// whether the column should be displayed
display?: boolean;
// left or right (default: left)
align?: string;
// the column width
width?: string;
// a function that describes how the columns should be sorted
compare?: (a: any, b: any) => number;
// how the column field should be displayed
transform?: (data: any) => string;
}
```

##### `rows`

The prop rows is an array of objects withs keys for each column name.

```ts
export interface Row {
[key: string]: any;
}

const rows: Row[] = {
/*...*/
};
```

##### `onRowSelect`

The prop onRowSelect is an callback that is triggered whenever a row is clicked. It receives as paramenter the row it self.

```ts
type OnRowSelect = (row: Row) => void;
```

### `WithSearch`

```html

```

`WithSearch` is a wrapper for `DataTable`. It receives the same props and pass then along through `slot-scope`. In addition to that it receives a `defaultFilter` prop which correspond to a column name.