# detail_row_editor

> Vuetable extension which can be used to implement expanding editor row with save / cancel options.

Latest version **2.0.1** (published 2018-06-29) · 0 weekly downloads

## Install

```sh
npm install detail_row_editor
pnpm add detail_row_editor
yarn add detail_row_editor
bun add detail_row_editor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2018-06-29 |
| First published | 2018-06-09 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.0.0 |
| Dependencies | 5 |
| Unpacked size | 37.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Kamil Bęben |
| Maintainers | kamil7124 |

## Links

- npm: https://www.npmjs.com/package/detail_row_editor
- npm.io page: https://npm.io/package/detail_row_editor

## Dependencies (5)

- [vue](https://npm.io/package/vue.md) ^2.5.2
- [bootstrap](https://npm.io/package/bootstrap.md) ^4.1.1
- [vue-events](https://npm.io/package/vue-events.md) ^3.1.0
- [vuetable-2](https://npm.io/package/vuetable-2.md) ^1.7.5
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.24.1

## Recent versions

- 2.0.1 (latest) — 2018-06-29
- 2.0.0 — 2018-06-14
- 1.0.4 — 2018-06-12
- 1.0.3 — 2018-06-12
- 1.0.2 — 2018-06-10
- 1.0.0 — 2018-06-09

## README

# Vuetable-2 Detail row editor
Details row editor meant for [Vuetable-2](https://github.com/ratiw/vuetable-2)

![Example image](http://bezik712.ayz.pl/assets/detail-row-entry-example.gif)

# Usage
## Inside template
```html
<vuetable ref="vuetable"
    ...
    detail-row-component="detail-row"
    ...
  ></vuetable>
```
## Inside script
```javascript
import DetailRowEditor from 'detail-row-editor/src/components/DetailRowEditor'
Vue.component('detail-row', DetailRowEditor);
```
# Properties
Due to the fact that vuetable passes only two props to it's details row (rowData and rowIndex) any other properties needs to be passed this way
```javascript

Vue.prototype.detailRowOptions = {
  onSave: (data) => {
  return new Promise((resolve) =>  {
      // Do stuff using data. Unless autoHideOnSaveOrCancel is set to false, the details row will be hidden when this promise is resolved
      resolve();
    });
  };
};
```
Name | Type | Default value | Description
--- | --- | --- | ---
autoRowUpdateAfterChange | boolean | `true` | If set to true, the parent row will be updated on every change
autoRowUpdateAfterSave | boolean | `true` | If set to true, the parent row will be updated after save
autoHideOnSaveOrCancel | boolean | `true` | If set to true, the details row will be automatically hidden after save / cancel
onSave | function | `null` | Function which will be called on **save**. It takes data as an argument and it is required to return a `Promise` object. See example code for tips on error handling. 
onCancel | function | `null` | Function which will be called on **cancel**. It is required to return a `Promise` object.
header | Component | `null` | Header component
footer | Component | `null` | Custom footer component
showFooter | boolean | `true` | Whenever footer (buttons) should be hidden
buttonClasses | String | `''` | Classes which will be added to save / cancel buttons (separated by space)
boldLabel | boolean | `false` | Whenever field title should be bolded 
fields | array | `[]` | Must be set in order for editor to work

# Field properties
Fields also should have certain properties specified in order to be editable.

Name | Type | Default value | Description
--- | --- | --- | ---
editable | boolean | `false` | **Important!** You must set this value to true in order for it to be editable
type | String | `text` | Any valid HTML input type will do (note that no additional attributes will be added, so there is no point in specifying a radio type for example)
detailRowComponent | Component | `null` | Custom field component. See example for more detailed informations

# Example code
``` bash
# clone project
git clone https://github.com/kamilbeben/detail-row-editor.git
cd detail-row-editor

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev
```

---
_Source: https://npm.io/package/detail_row_editor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
