crud-view
CRUD views for Polymer apps
<crud-view>
<crud-view> is a Polymer Element and a couple of Mixins providing an easy way to display, sort, filter and make modifications to a list of JSON objects.
Example usage:
my-list.html
...
<dom-module id="ny-list">
<template>
<iron-ajax auto url="users.json" handle-as="json" last-response="{{items}}"></iron-ajax>
<crud-view item="[[item]]">
<vaadin-text-field slot="header" placeholder="Search ..." value="{{search}}"></vaadin-text-field>
<vaadin-button slot="header" on-click="new" theme="primary">New Item</vaadin-button>
<vaadin-grid slot="grid" id="grid" items="[[filter(items, search, items.*)]]" active-item="{{activeItem}}">
<vaadin-grid-column>
<template class="header">Email</template>
<template>[[item.email]]</template>
</vaadin-grid-column>
<vaadin-grid-column>
<template class="header">
<vaadin-grid-sorter path="name">Name</vaadin-grid-sorter>
</template>
<template>[[item.name]] [[item.last]]</template>
</vaadin-grid-column>
</vaadin-grid>
<template class="editor">
<my-editor item="[[item]]" on-save="save" on-delete="delete" on-close="close"></my-editor>
</template>
</crud-view>
</template>
<script>
class MyList extends window.CrudListMixin(Polymer.Element) {
static get is() {
return 'ny-list';
}
}
window.customElements.define(MyList.is, MyList);
</script>
</dom-module>
my-editor.html
...
<dom-module id="my-editor">
<template>
<vaadin-form-layout>
<vaadin-text-field label="Email (login)" value="{{item.email}}" colspan="2" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$"></vaadin-text-field>
<br>
<vaadin-password-field label="Password" value="{{item.password}}" colspan="2" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}"></vaadin-password-field>
</vaadin-form-layout>
</template>
<script>
class MyEditor extends window.CrudItemMixin(Polymer.Element) {
static get is() {
return 'my-editor';
}
}
window.customElements.define(MyEditor.is, MyEditor);
</script>
</dom-module>
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Dependencies
- webcomponentsjs#^2.2.4
- polymer#^2.0.0
- vaadin-grid#^5.2.7
- vaadin-dialog#^2.2.1
- Released
- 2019-01-18
- Maturity
- IMPORTED
- License
- Apache License 2.0
Compatibility
- Framework
- Polymer 2.0+
- Browser
- Browser Independent
crud-view - Vaadin Add-on Directory
CRUD views for Polymer appsGitHub Homepage
Issue tracker
crud-view version 1.0.0
### Dependencies
* polymer#^2.0.0
* vaadin-dialog#^1.0.0
* starter-elements#vaadin/starter-elements#^0.0.1
crud-view version 1.0.1
### Dependencies
* polymer#^2.0.0
* vaadin-dialog#^1.0.0
* starter-elements#vaadin/starter-elements#^0.0.3
crud-view version 1.0.2
### Dependencies
* polymer#^2.0.0
* vaadin-dialog#^1.0.0
* starter-elements#vaadin/starter-elements#^0.0.5
crud-view version 1.0.3
### Dependencies
* polymer#^2.0.0
* vaadin-dialog#^1.0.0
* vaadin-valo-theme#2.0.0-alpha5
* vaadin-overlay#2.0.4
crud-view version 1.0.4
### Dependencies
* polymer#^2.0.0
* vaadin-dialog#vaadin/vaadin-dialog#^2.1.0
* vaadin-valo-theme#2.0.0-alpha5
* vaadin-overlay#vaadin/vaadin-overlay#^3.1.1
crud-view version 1.0.5
### Dependencies
* webcomponentsjs#^2.2.4
* polymer#^2.0.0
* vaadin-grid#^5.2.7
* vaadin-dialog#^2.2.1