@@ -129,23 +129,34 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
129129 *
130130 * A grid and an editor will be automatically generated and configured based on the data structure provided.
131131 *
132- * #### Example:
133132 * ```html
134- * <vaadin-crud items='[{"name": "John", "surname": "Lennon", "role": "singer"},
135- * {"name": "Ringo", "surname": "Starr", "role": "drums"}]'></vaadin-crud>
133+ * <vaadin-crud></vaadin-crud>
134+ * ```
135+ *
136+ * ```js
137+ * const crud = document.querySelector('vaadin-crud');
138+ *
139+ * crud.items = [
140+ * { name: 'John', surname: 'Lennon', role: 'singer' },
141+ * { name: 'Ringo', surname: 'Starr', role: 'drums' },
142+ * // ... more items
143+ * ];
136144 * ```
137145 *
138146 * ### Data Provider Function
139147 *
140148 * Otherwise, you can provide a [`dataProvider`](#/elements/vaadin-crud#property-dataProvider) function.
141- * #### Example:
142- * ```html
143- * <vaadin-crud></vaadin-crud>
144- * ```
149+ *
145150 * ```js
146151 * const crud = document.querySelector('vaadin-crud');
147- * const users = [{'name': 'John', 'surname': 'Lennon', 'role': 'singer'}, ...];
148- * crud.dataProvider = function(params, callback) {
152+ *
153+ * const users = [
154+ * { name: 'John', surname: 'Lennon', role: 'singer' },
155+ * { name: 'Ringo', surname: 'Starr', role: 'drums' },
156+ * // ... more items
157+ * ];
158+ *
159+ * crud.dataProvider = (params, callback) => {
149160 * const chunk = users.slice(params.page * params.pageSize, params.page * params.pageSize + params.pageSize);
150161 * callback(chunk, people.length);
151162 * };
@@ -171,11 +182,7 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
171182 * #### Example:
172183 *
173184 * ```html
174- * <vaadin-crud
175- * id="crud"
176- * items='[{"name": "John", "surname": "Lennon", "role": "singer"},
177- * {"name": "Ringo", "surname": "Starr", "role": "drums"}]'
178- * >
185+ * <vaadin-crud id="crud">
179186 * <vaadin-grid slot="grid">
180187 * <vaadin-crud-edit-column></vaadin-crud-edit-column>
181188 * <vaadin-grid-column id="column1"></vaadin-grid-column>
@@ -213,6 +220,12 @@ export type CrudEventMap<T> = CrudCustomEventMap<T> & HTMLElementEventMap;
213220 * column2.renderer = (root, column, model) => {
214221 * root.textContent = model.item.surname;
215222 * };
223+ *
224+ * crud.items = [
225+ * { name: 'John', surname: 'Lennon', role: 'singer' },
226+ * { name: 'Ringo', surname: 'Starr', role: 'drums' },
227+ * // ... more items
228+ * ];
216229 * ```
217230 *
218231 * ### Helpers
0 commit comments