forked from vaadin/vaadin-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvaadin-grid.html
1506 lines (1342 loc) · 38.6 KB
/
vaadin-grid.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
@license
Copyright (c) 2015 Vaadin Ltd.
This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
-->
<link rel='import' href='../polymer/polymer.html'>
<script src="vaadin-grid.min.js"></script>
<style>
vaadin-grid > table {
display: none;
}
.vaadin-grid-sidebar-popup {
background-color: #ffffff;
box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 6px 0 rgba(0,0,0,.12);
border-radius: 2px;
font-family: arial;
font-size: 12px;
transition: opacity 0.1s ease-in;
}
.vaadin-grid-sidebar-content > div {
padding: 16px 0;
}
.vaadin-grid-sidebar-content span:before {
content: url(img/ic_check_black_24px.svg);
opacity: 0.6;
display: inline-block;
padding: 0 10px;
}
.vaadin-grid-sidebar-content span div {
display: inline-block;
}
.vaadin-grid-sidebar-content .v-off:before {
visibility: hidden;
}
.vaadin-grid-sidebar-content span div {
display: inline-block;
vertical-align: super;
padding-right: 20px;
}
.vaadin-grid-sidebar-content table {
border-collapse: collapse;
border-top: 1px solid #E6E6E6;
border-bottom: 1px solid #E6E6E6;
min-width: 150px;
}
.vaadin-grid-sidebar-content .column-hiding-toggle {
cursor: pointer;
white-space: nowrap;
}
.vaadin-grid-sidebar-content .gwt-MenuItem-selected {
background: #eeeeee;
}
</style>
<!--
High quality data grid for showing large amounts of tabular data.
Simple usage (static HTML data source):
```html
<vaadin-grid>
<table>
<colgroup>
<col name="firstName">
<col name="lastName">
<col name="email">
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Value</th>
<th>Progress</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jonathan</td>
<td>Doe</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Jane</td>
<td>Smith</td>
<td>[email protected]</td>
</tr>
</tbody>
</table>
</vaadin-grid>
```
### Styling
The grid uses `--primary-color` from [paper-styles](https://github.com/PolymerElements/paper-styles) as a highlight color. You can customize the color by defining your own primary default color.
```html
<style is="custom-style">
vaadin-grid {
--primary-color: red;
}
</style>
```
The following custom properties are available for styling:
Custom property | Description | Default
:----------------|:-------------|----------:
`--vaadin-grid-row-height` | Data row height | `48px`
`--vaadin-grid-header-row-height` | Header row height | `56px`
`--vaadin-grid-footer-row-height` | Footer row height | `56px`
`--vaadin-grid-selected-row-cell` | Mixin which applies to the cell elements of a selected row | {}
`--vaadin-grid-row-cell` | Mixin which applies to the cell elements of the table | {}
`--vaadin-grid-row-stripe-cell` | Mixin applied on the cells of the striped rows | {}
See the [demo](demo/index.html) for use case examples.
@element vaadin-grid
@demo demo/index.html
-->
<dom-module id="vaadin-grid">
<style>
/* Host styles */
:host {
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
box-sizing: border-box;
font-family: inherit;
font-size: 13px;
font-weight: 400;
line-height: 1.1;
color: rgba(0, 0, 0, 0.87);
cursor: default;
transition: opacity 50ms;
white-space: nowrap;
position: relative;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
:host(.vaadin-grid-loading) {
height: 0;
opacity: 0;
transition: none;
}
:host > div {
height: 100%;
outline: none;
position: relative;
z-index: 0;
-webkit-flex: 1 1 auto;
flex: 1 1 auto;
}
/* Anim */
@keyframes vaadin-grid-spin-360 {
100% {
transform: rotate(360deg);
}
}
@-webkit-keyframes vaadin-grid-spin-360 {
100% {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
}
/* Table wrapper */
.vaadin-grid-tablewrapper {
box-sizing: border-box;
overflow: hidden;
outline: none;
position: absolute;
z-index: 5;
}
.vaadin-grid-tablewrapper:before {
display: none;
}
.vaadin-grid-tablewrapper > table {
box-sizing: border-box;
display: block;
}
.vaadin-grid-loading-data .vaadin-grid-tablewrapper:before {
-webkit-animation: vaadin-grid-spin-360 400ms linear infinite;
animation: vaadin-grid-spin-360 400ms linear infinite;
border: 2px solid var(--primary-color, #03A9F4);
border-radius: 50%;
border-right-color: transparent;
border-top-color: transparent;
content: "";
display: block;
height: 16px;
left: 50%;
margin-left: -8px;
margin-top: -8px;
position: absolute;
top: 50%;
width: 16px;
}
/* Scroller styles */
.vaadin-grid-scroller {
box-sizing: border-box;
outline: none;
position: absolute;
z-index: 1;
}
.vaadin-grid-scroller-horizontal {
bottom: 0;
left: 0;
right: 0;
overflow-y: hidden;
-ms-overflow-y: hidden;
}
.vaadin-grid-scroller-vertical {
bottom: 0;
right: 0;
top: 0;
overflow-x: hidden;
-ms-overflow-x: hidden;
}
.vaadin-grid-horizontal-scrollbar-deco {
bottom: 0;
box-sizing: border-box;
left: 0;
position: absolute;
right: 0;
}
/* Grid body */
.vaadin-grid-body {
box-sizing: border-box;
display: block;
left: 0;
position: absolute;
top: 0;
z-index: 0;
}
:host(:not([selection-mode])) .vaadin-grid-body,
:host([selection-mode="single"]) .vaadin-grid-body {
cursor: pointer;
}
.vaadin-grid-body tr {
height: var(--vaadin-grid-row-height, 48px);
left: 0;
top: 0;
position: absolute;
}
:host ::content .vaadin-grid-spacer {
position: absolute;
border-bottom: 1px solid #e3e3e3;
z-index: 1;
}
:host ::content .vaadin-grid-spacer > td {
position: absolute;
padding: 0;
top: 0;
left: 0;
width: 100%;
}
.vaadin-grid-body td {
opacity: 0;
}
.vaadin-grid-row-has-data td {
border-bottom: 1px solid #e3e3e3;
opacity: 1;
}
.vaadin-grid-spacer td {
opacity: 1;
}
/* Row styles */
.vaadin-grid-row {
box-sizing: border-box;
display: block;
}
tbody:not(.touch):not(.scrolling) .vaadin-grid-row:hover td {
background-color: #eeeeee;
}
.vaadin-grid-row-stripe td {
@apply(--vaadin-grid-row-stripe-cell);
}
.vaadin-grid-row-selected td {
background-color: #f5f5f5;
@apply(--vaadin-grid-selected-row-cell);
}
/* Focus styles */
.vaadin-grid-row:after {
background-color: var(--primary-color, #03A9F4);
bottom: 0;
content: "";
height: 2px;
left: 0;
pointer-events: none;
position: absolute;
right: 0;
transition: all 0.16s ease-in-out;
-webkit-transform: scaleX(0.0);
transform: scaleX(0.0);
z-index: 1;
}
:focus .vaadin-grid-row-focused:after {
-webkit-transform: scaleX(1.0);
transform: scaleX(1.0);
}
/* Grid cell */
.vaadin-grid-cell {
-webkit-align-items: center;
align-items: center;
background-color: white;
box-sizing: border-box;
display: -webkit-inline-flex;
display: inline-flex;
height: inherit;
overflow: hidden;
transition: opacity 0.1s ease-in;
}
/* Grid header */
.vaadin-grid-header {
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06),
0 2px 0 rgba(0, 0, 0, 0.075),
0 3px 0 rgba(0, 0, 0, 0.05),
0 4px 0 rgba(0, 0, 0, 0.015);
box-sizing: border-box;
display: block;
left: 0;
position: absolute;
top: 0;
z-index: 10;
padding-right: 2px;
}
.vaadin-grid-header tr {
height: var(--vaadin-grid-header-row-height, 56px);
}
.vaadin-grid-header th {
color: rgba(0, 0, 0, 0.54);
font-size: 12px;
font-weight: 500;
text-align: left;
position: relative;
}
.vaadin-grid-header-deco {
background-color: white;
border-left: 1px solid rgba(255, 255, 255, 0.3);
box-sizing: border-box;
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
/* Sorting */
.vaadin-grid-header [class*="sort-"] {
font-weight: 500;
font-size: 12px;
color: rgba(0, 0, 0, 0.87);
position: relative;
}
.vaadin-grid-header [class*="sort-"]:after {
font-size: 8px;
padding-left: 8px;
width: 1em;
min-width: 12px;
display: inline-block;
}
.vaadin-grid-header .sort-asc:after {
content: url(img/arrow-up.svg) " " attr(sort-order);
}
.vaadin-grid-header .sort-desc:after {
content: url(img/arrow-down.svg) " " attr(sort-order);
}
/* Grid footer */
.vaadin-grid-footer {
bottom: 0;
box-sizing: border-box;
display: block;
left: 0;
position: absolute;
z-index: 10;
box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
}
.vaadin-grid-footer td {
font-size: 12px;
font-weight: 500;
color: rgba(0, 0, 0, 0.56);
height: var(--vaadin-grid-footer-row-height, 56px);
}
.vaadin-grid-footer-deco {
bottom: 0;
box-sizing: border-box;
position: absolute;
right: 0;
z-index: 1;
}
.vaadin-grid-spacer-deco-container {
display: none;
}
/* Cell padding */
.vaadin-grid-header th,
.vaadin-grid-body td,
.vaadin-grid-footer td {
padding: 0 24px 0 24px;
@apply(--vaadin-grid-row-cell);
}
.vaadin-grid-cell.last-frozen {
border-right: 1px solid #e3e3e3;
}
.vaadin-grid-cell.frozen {
position: relative;
z-index: 1;
}
/* Input styles */
input[type="checkbox"] {
position: absolute;
opacity: 0;
}
input[type="checkbox"] + label {
position: relative;
left: 0;
box-sizing: border-box;
display: block;
width: 18px;
height: 18px;
border: 2px solid #7a7a7a;
border-radius: 2px;
cursor: pointer;
transition: background-color 120ms, border-color 120ms;
}
input[type="checkbox"]:focus {
outline: none;
}
input[type="checkbox"] + label:after {
content: url(img/tick.svg);
position: absolute;
top: -1px;
left: -1px;
display: block;
width: 16px;
height: 17px;
transition: all 200ms;
-webkit-transform: scale(0);
transform: scale(0);
-webkit-transform-origin: 40% 80%;
transform-origin: 40% 80%;
}
input[type="checkbox"]:checked + label {
background-color: var(--primary-color, #03A9F4);
border-color: transparent;
}
input[type="checkbox"]:checked + label:after {
-webkit-transform: scale(1);
transform: scale(1);
}
input[type="checkbox"]:indeterminate + label:after {
content: "–";
font-family: arial;
font-weight: bold;
font-size: 14px;
line-height: 1;
text-align: center;
-webkit-transform: scale(1);
transform: scale(1);
transition: none;
}
/* Activation "splash" */
input[type="checkbox"] + label:before {
content: "";
position: absolute;
top: -13px;
left: -13px;
width: 41px;
height: 41px;
border-radius: 50%;
opacity: 0;
-webkit-transform: scale(0.8);
transform: scale(0.8);
transition: all 180ms cubic-bezier(0.75,.0,0.25,1);
}
input[type="checkbox"] + label:active:before {
transform: scale(1.1);
opacity: 0.15;
transition-duration: 80ms;
transition-property: all;
}
input[type="checkbox"]:checked + label:before {
background-color: var(--primary-color, #03A9F4);
}
#measureobject {
width: 100% !important;
height: 100%;
z-index: -1 !important;
pointer-events: none !important;
position: absolute !important;
left: -100% !important;
top: -100% !important;
opacity: 0 !important;
/* This is used to force a non-zero client height to the measure object. */
padding-bottom: 1px !important;
}
/* The following is a workaround to https://dev.vaadin.com/ticket/18376 */
.vaadin-grid-scroller[invisible]::-webkit-scrollbar {
border: none;
}
.vaadin-grid-scroller[invisible]::-webkit-scrollbar-thumb {
border-radius: 10px;
border: 4px solid transparent;
background: rgba(0,0,0,.3);
-webkit-background-clip: content-box;
background-clip: content-box;
}
.vaadin-grid-scroller-vertical[invisible]::-webkit-scrollbar-thumb {
min-height: 30px;
}
.vaadin-grid-scroller-horizontal[invisible]::-webkit-scrollbar-thumb {
min-width: 30px;
}
.vaadin-grid-sidebar {
z-index: 5;
position: absolute;
top: 2px;
pointer-events: none;
right: 0;
padding-right: 4px;
overflow: hidden;
width: 38px;
height: 38px;
}
.vaadin-grid-sidebar-button {
width: var(--vaadin-grid-header-row-height, 56px);
height: var(--vaadin-grid-header-row-height, 56px);
border: none;
background: none;
outline: none;
position: relative;
cursor: pointer;
pointer-events: all;
}
.vaadin-grid-sidebar-button::before {
content: "";
position: absolute;
left: 12px;
top: 10px;
width: 32px;
height: 32px;
border-radius: 50%;
background: #fff;
box-shadow: 0 0 10px 4px #fff;
}
.vaadin-grid-sidebar-button:after {
content: url(img/ic_view_column_black_24px.svg);
opacity: 0.4;
display: inline-block;
position:absolute;
top: 14px;
left: 16px;
width: 24px;
}
@keyframes vaadin-grid-sidebar-transition {
0% {
opacity: 0;
top: 48px;
}
100% {
opacity: 1;
top: 44px;
}
}
@-webkit-keyframes vaadin-grid-sidebar-transition {
0% {
opacity: 0;
top: 48px;
}
100% {
opacity: 1;
top: 44px;
}
}
:host ::content .header-drag-table,
.header-drag-table {
display: block;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
.dragged-column-header {
background-color: var(--primary-background-color, #EEEEEE);
position: absolute;
margin-top: calc(var(--vaadin-grid-header-row-height, 56px) * 0.75);
box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
:host ::content .vaadin-grid-drop-marker,
.vaadin-grid-drop-marker {
background-color: var(--primary-color, #03A9F4);
position: absolute;
width: 2px;
}
:host ::content .vaadin-grid-drop-marker::before,
.vaadin-grid-drop-marker::before {
content: "";
display: block;
width: 1px;
background: rgba(0,0,0,0.07);
height: 9999px;
margin-top: var(--vaadin-grid-header-row-height, 56px);
}
.vaadin-grid-header th.dragged {
opacity: 0.3;
}
:host ::content th.vaadin-grid-cell,
th.vaadin-grid-cell {
overflow: visible;
}
:host ::content div.vaadin-grid-column-header-content,
div.vaadin-grid-column-header-content {
overflow: hidden;
width: 100%;
}
:host ::content .vaadin-grid-column-resize-handle,
.vaadin-grid-column-resize-handle {
position: absolute;
cursor: col-resize;
right: 0;
top: 0;
height: 100%;
width: 36px;
transform: translateX(50%);
text-align: center;
z-index: 10;
}
:host ::content .vaadin-grid-column-resize-handle:after,
.vaadin-grid-column-resize-handle:after {
display: inline-block;
height: 100%;
content:"";
border-left: solid 1px #e3e3e3;
}
:host ::content .vaadin-grid-column-resize-handle:active:after,
.vaadin-grid-column-resize-handle:active:after,
:host ::content .vaadin-grid-column-resize-handle:hover:after,
.vaadin-grid-column-resize-handle:hover:after {
border-left: solid 1px var(--primary-color, #03A9F4);
}
:host ::content .vaadin-grid-column-resize-handle-dragged,
.vaadin-grid-column-resize-handle-dragged,
:host ::content .vaadin-grid-column-resize-handle:active,
.vaadin-grid-column-resize-handle:active {
transition: all 0.16s ease-in-out;
height: 3000px;
}
:host ::content .header-drag-table .vaadin-grid-header,
.header-drag-table .vaadin-grid-header {
box-shadow: none;
}
</style>
<template>
<iframe id="measureobject" class="vaadin-grid"></iframe>
</template>
</dom-module>
<script>
Polymer({
is: 'vaadin-grid',
_grid: undefined,
properties: {
/**
* A function which is used for generating CSS class names for data cells.
*
* See the API documentation for the `Cell` object for more details about
* the parameter of this function.
*
* #### Example:
* ```js
* grid.cellClassGenerator = function(cell) {
* if (cell.index == 2) {
* return "activity-" + cell.data.toLowerCase();
* }
* };
* ```
* @property {Function} cellClassGenerator
* @type {Function}
*/
cellClassGenerator: {
type: Function,
observer: '_cellClassGeneratorChanged'
},
/**
* Disables the grid.
*
* #### Declarative example:
* ```html
* <vaadin-grid disabled>...</vaadin-grid>
* ```
*
* @default false
* @type {Boolean}
*/
disabled: {
type: Boolean,
observer: '_disabledChanged',
reflectToAttribute: true,
value: false
},
/**
* Object for controlling and accessing the header rows in the grid.
*
* See the API documentation for `Header` for more details.
*
* @property {Header} footer
* @type {Header}
*/
header: {
type: Object,
readOnly: true,
value: function() {
var _this = this;
return {
getCell: function(rowIndex, columnId) {
return _this._grid.getStaticSection().getHeaderCell(rowIndex, columnId);
},
addRow: function(rowIndex, cellContent) {
_this._grid.getStaticSection().addHeader(rowIndex, cellContent);
},
removeRow: function(rowIndex) {
_this._grid.getStaticSection().removeHeader(rowIndex || 0);
},
setRowClassName: function(rowIndex, className) {
_this._grid.getStaticSection().setHeaderRowClassName(rowIndex, className);
},
get defaultRow() {
return _this._grid.getStaticSection().getDefaultHeader();
},
set defaultRow(rowIndex) {
_this._grid.getStaticSection().setDefaultHeader(rowIndex);
},
get hidden() {
return _this._grid.getStaticSection().isHeaderHidden();
},
set hidden(hidden) {
_this._grid.getStaticSection().setHeaderHidden(hidden);
},
get rowCount() {
return _this._grid.getStaticSection().getHeaderRowCount();
}
};
}
},
/**
* Object for controlling and accessing the footer rows in the grid.
*
* See the API documentation for `Footer` for more details.
*
* @property {Footer} footer
* @type {Footer}
*/
footer: {
type: Object,
readOnly: true,
value: function() {
var _this = this;
return {
getCell: function(rowIndex, columnId) {
return _this._grid.getStaticSection().getFooterCell(rowIndex, columnId);
},
addRow: function(rowIndex, cellContent) {
_this._grid.getStaticSection().addFooter(rowIndex, cellContent);
},
removeRow: function(rowIndex) {
_this._grid.getStaticSection().removeFooter(rowIndex || 0);
},
setRowClassName: function(rowIndex, className) {
_this._grid.getStaticSection().setFooterRowClassName(rowIndex, className);
},
get hidden() {
return _this._grid.getStaticSection().isFooterHidden();
},
set hidden(hidden) {
_this._grid.getStaticSection().setFooterHidden(hidden);
},
get rowCount() {
return _this._grid.getStaticSection().getFooterRowCount();
}
};
}
},
/**
* The index of the last frozen columns in this grid. A frozen column will
* always stay visible in the grid viewport when the user scrolls the grid
* viewport horizontally.
*
* Setting the property to 0 means that no columns will be frozen,
* but the built-in selection checkbox column will still be frozen if
* it’s in use. Setting the count to -1 will unfreeze the selection
* column also.
*
* #### Declarative example:
* ```html
* <vaadin-grid frozen-columns="2">...</vaadin-grid>
* ```
*
* @default 0
* @type {Number}
*/
frozenColumns: {
type: Number,
observer: '_applyFrozenColumns',
reflectToAttribute: true,
value: 0
},
/**
* An array or a function containing or returning items determining
* the row data in the grid (i.e. the data source).
*
* Implement the property as a function if you wish to provide data
* lazily to the grid, for example from a REST service, to get only the
* items that are necessary in the grid viewport.
*
* See the API documentation for `ItemsFunction` for more details.
*
* For an in-memory list of items, use the `items` array property instead.
*
* In both options, at the end the grid expects to receive an array, which
* can contain either arrays, objects or primitive types.
*
* #### Examples:
* ```
* grid.items = [
* {
* firsName: "Jonathan",
* lastName: "Doe",
* email: "[email protected]"
* },
* {
* firstName: "Jane",
* lastName: "Smith",
* email: "[email protected]"
* }
* ];
* ```
* ```
* grid.items = function(params, callback) {
* callback(["foo", "bar"], 2);
* };
* ```
*
* @property {(Array<Object>|Function)} items
* @type {(Array<Object>|Function)}
*/
items: {
type: Object
},
/**
* The array of columns attached to the grid.
*
* See the API documentation for `Column` for more details about the
* column objects.
*
* @property {Array<Object>} columns
* @type {Array<Object>}
*/
columns: {
type: Array,
notify: true
},
/**
* A function which is used for generating CSS class names for data rows.
*
* See the API documentation for the `Row` object for more details about
* the parameter of this function.
*
* #### Example:
* ```js
* grid.rowClassGenerator = function(row) {
* var activity = row.data[2];
* return "activity-" + activity.toLowerCase();
* };
*```
*
* @property {Function} rowClassGenerator
* @type {Function}
*/
rowClassGenerator: {
type: Function,
observer: '_rowClassGeneratorChanged'
},
/**
* The row details generator is used for generating detail content for
* data rows. The details element is added directly under the row.
*
* #### Example:
* ```js
* grid.rowDetailsGenerator = function(rowIndex) {
* var detail = document.createElement("div");
* detail.textContent = "Row detail content for row " + rowIndex;
* return detail;
* };
*```
*
* @property {Function} rowDetailsGenerator
* @type {Function}
*/
rowDetailsGenerator: {
type: Function,
observer: '_rowDetailsGeneratorChanged'