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
|
<!--
@element v-grid
-->
<link rel='import' href='vaadin-grid-import.html'>
<link rel='import' href='../../polymer/polymer.html'>
<style>
v-grid > table {
display: none;
}
</style>
<!--
Vaadin v-grid is a grid component fully configurable and customizable, plenty of features and with the mind set on performance.
-->
<dom-module id="v-grid">
<style>
/* Functional properties */
:host {
white-space: nowrap;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
transition: opacity 200ms;
cursor: default;
}
:host(.loading) {
opacity: 0;
height: 0;
transition: none;
}
:host,
.v-grid-tablewrapper > table,
.v-grid-body,
.v-grid-header,
.v-grid-footer,
.v-grid-row {
display: block;
box-sizing: border-box;
}
.v-grid-cell {
display: -webkit-inline-flex;
display: inline-flex;
-webkit-align-items: center;
align-items: center;
box-sizing: border-box;
overflow: hidden;
text-overflow: ellipsis;
background: #fff;
}
:host > div {
position: relative;
outline: none;
}
.v-grid-scroller {
position: absolute;
z-index: 1;
outline: none;
box-sizing: border-box;
}
.v-grid-scroller-horizontal {
left: 0;
right: 0;
bottom: 0;
overflow-y: hidden;
-ms-overflow-y: hidden;
}
.v-grid-scroller-vertical {
right: 0;
top: 0;
bottom: 0;
overflow-x: hidden;
-ms-overflow-x: hidden;
}
.v-grid-tablewrapper {
position: absolute;
overflow: hidden;
box-sizing: border-box;
z-index: 5;
outline: none;
}
.v-grid-header-deco,
.v-grid-footer-deco,
.v-grid-horizontal-scrollbar-deco {
position: absolute;
right: 0;
box-sizing: border-box;
}
.v-grid-header,
.v-grid-body,
.v-grid-footer {
position: absolute;
left: 0;
z-index: 10;
}
.v-grid-header,
.v-grid-header-deco {
top: 0;
}
.v-grid-footer,
.v-grid-footer-deco {
bottom: 0;
}
.v-grid-horizontal-scrollbar-deco {
left: 0;
bottom: 0;
}
.v-grid-body {
z-index: 0;
top: 0;
}
.v-grid-body .v-grid-row {
position: absolute;
top: 0;
left: 0;
}
:host(:not([selection-mode])) .v-grid-body,
:host([selection-mode="single"]) .v-grid-body {
cursor: pointer;
}
.v-grid-editor {
position: absolute;
z-index: 20;
overflow: hidden;
left: 0;
right: 0;
margin-top: -1px;
}
.v-grid-editor-cells {
position: relative;
}
.v-grid-editor-cells > div {
display: inline-block;
}
.v-grid-editor-footer {
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
box-sizing: border-box;
}
.v-grid-editor-message {
-webkit-flex: 1;
flex: 1;
}
/* Theming properties */
:host {
font: 400 100%/1.1 Roboto, sans-serif;
color: rgba(0, 0, 0, 0.83);
}
.v-grid-cell {
padding: 0 16px;
height: 32px;
}
.v-grid-header,
.v-grid-header-deco {
box-shadow: 0px 3px 2px 0px rgba(0, 0, 0, 0.20);
}
.v-grid-header th {
background: #03A9F4;
color: #fff;
text-transform: uppercase;
font-weight: 600;
font-size: 0.8125em;
height: 32px;
border-right: 1px solid rgba(255, 255, 255, 0.3);
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
.v-grid-header-deco {
background: #03A9F4;
border-left: 1px solid rgba(255, 255, 255, 0.3);
z-index: 1;
}
.v-grid-header [class*="sort-"] {
position: relative;
padding-right: 32px;
}
.v-grid-header [class*="sort-"]:after {
position: absolute;
font-family: sans-serif;
content: url(sort-asc.svg) " " attr(sort-order);
right: 12px;
font-size: 12px;
width: 11px;
height: 5px;
}
.v-grid-header .sort-desc:after {
content: url(sort-desc.svg) " " attr(sort-order);
}
.v-grid-header [class*="sort-"][sort-order]:after {
right: 20px;
}
.v-grid-footer td,
.v-grid-footer-deco,
.v-grid-horizontal-scrollbar-deco {
background: #E6E6E6;
font-size: 0.8125em;
font-weight: 500;
color: rgba(0, 0, 0, 0.56);
}
.v-grid-footer td {
border-right: 1px solid rgba(255, 255, 255, 0.5);
border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}
.v-grid-footer-deco {
border-left: 1px solid rgba(255, 255, 255, 0.5);
}
.v-grid-horizontal-scrollbar-deco {
border-top: 1px solid rgba(255, 255, 255, 0.5);
}
.v-grid-header th:last-child,
.v-grid-footer td:last-child {
border-right: 0;
}
.v-grid-header tr:last-child th,
.v-grid-footer tr:last-child td {
border-bottom: 0;
}
/* TODO We need some other way of defining the frozen column divider than
using the cell, since this will affect all frozen columns, when we only
want to apply it to the last frozen column .*/
/* Double selector to increase specificity. Otherwise Polymer increases the
specificity of the ".v-grid-header th" more than this, and we can't
override the border */
.v-grid-cell.frozen.frozen {
position: relative;
z-index: 1;
border-right: 0;
box-shadow: 1px 0 0 0 rgba(0,0,0,0.04),
2px 0 0 0 rgba(0,0,0,0.04),
3px 0 0 0 rgba(0,0,0,0.04),
4px 0 0 0 rgba(0,0,0,0.04);
}
.v-grid-row-selected > td {
background-color: #f2f2f2;
}
.v-grid-editor {
background: #fff;
box-shadow: 0 0 0 1px rgba(0,0,0,0.15),
0 8px 17px 0 rgba(0,0,0,0.2),
0 6px 20px 0 rgba(0,0,0,0.188235);
margin-top: -5px;
}
.v-grid-editor[style*="bottom"] {
margin-top: 0;
margin-bottom: -5px;
}
.v-grid-editor input[type="text"],
.v-grid-editor input:not([type]) {
box-sizing: border-box;
width: 100%;
height: 100%;
padding: 0 0 1px;
font: inherit;
color: inherit;
border: 0;
border-bottom: 1px solid rgba(0,0,0,0.2);
background: transparent;
outline: none;
transition: all 200ms;
}
.v-grid-editor input[type="text"]:focus {
border-bottom: 2px solid #03A9F4;
padding-bottom: 0;
}
.v-grid-editor-cells > div {
box-sizing: border-box;
margin: 5px 0;
padding: 5px 16px;
height: 42px;
}
.v-grid-editor-buttons button {
height: 32px;
padding: 0 11px;
margin: 5px;
font: inherit;
font-size: 14px;
color: #03A9F4;
text-transform: uppercase;
background: transparent;
border: 0;
border-radius: 3px;
outline: none;
cursor: pointer;
transition: all 200ms;
}
.v-grid-editor-buttons button:focus {
box-shadow: 0 2px 6px 0 rgba(0,0,0,0.5);
}
.v-grid-editor-buttons button:active:focus {
box-shadow: none;
}
input[type="checkbox"] {
position: absolute;
opacity: 0;
}
input[type="checkbox"] + label {
position: relative;
left: 0;
box-sizing: border-box;
display: block;
width: 16px;
height: 16px;
border: 2px solid rgba(0,0,0,0.3);
border-radius: 2px;
cursor: pointer;
transition: background-color 120ms, border-color 120ms;
}
input[type="checkbox"]:focus {
outline: none;
}
input[type="checkbox"]:focus + label {
border-color: rgba(0,0,0,0.6);
}
input[type="checkbox"] + label:after {
content: url("tick.svg");
position: absolute;
top: -2px;
left: -2px;
display: block;
width: 16px;
height: 16px;
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: #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-size: 14px;
text-align: center;
-webkit-transform: none;
transform: none;
}
/* Activation "splash" */
input[type="checkbox"] + label:before {
content: "";
position: absolute;
top: -14px;
left: -14px;
width: 40px;
height: 40px;
border-radius: 50%;
background: #666;
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: #03A9F4;
}
/* Small adjustments for the checkbox in the header */
.v-grid-header input[type="checkbox"] + label {
border-color: rgba(255,255,255,0.5);
}
.v-grid-header input[type="checkbox"] + label:before {
background: #fff;
}
.v-grid-header input[type="checkbox"] + label:after {
transition: none;
}
/* Focus styles */
.v-grid-row-focused:after {
content: "";
position: absolute;
z-index: 1;
top: 0;
right: 0;
bottom: 0;
left: 0;
border: 1px solid rgba(0,0,0,0.2);
pointer-events: none;
opacity: 0;
transition: opacity 300ms;
}
:focus .v-grid-row-focused:after {
opacity: 1;
}
#measure {
width: 100% !important;
height: 100% !important;
z-index: -1 !important;
pointer-events: none !important;
position: relative !important;
float: left !important;
margin-left: -100% !important;
opacity: 0 !important;
}
#measureobject {
position: absolute !important;
width: 100% !important;
height: 100% !important;
}
</style>
<template>
<div id="measure" class="v-grid">
<object id="measureobject" class="v-grid" type="text/html"></object>
</div>
<content></content>
</template>
</dom-module>
<script>
function loadComponent() {
VGrid = Polymer({
is: "v-grid",
_grid: undefined,
properties: {
/**
* The row editor specific fields
*
* @property editor
* @type {Editor}
*/
editor: {
type: Object,
readOnly: true,
value: function() {
var _this = this;
return {
get enabled() {
return _this._grid.getEditor().isEnabled();
},
set enabled(enabled) {
_this._grid.getEditor().setEnabled(enabled);
if (_this.editable !== enabled) {
_this.editable = enabled;
}
},
get handler() {
return _this._grid.getEditor().getHandler();
},
set handler(handler) {
_this._grid.getEditor().setHandler(handler);
},
get saveButtonText() {
return _this._grid.getEditor().getSaveButtonText();
},
set saveButtonText(saveButtonText) {
_this._grid.getEditor().setSaveButtonText(saveButtonText);
},
get cancelButtonText() {
return _this._grid.getEditor().getSaveButtonText();
},
set cancelButtonText(cancelButtonText) {
_this._grid.getEditor().setCancelButtonText(cancelButtonText);
},
editRow: function(row) {
_this._grid.getEditor().editRow(row);
},
save: function() {
_this._grid.getEditor().save();
},
cancel: function() {
_this._grid.getEditor().cancel();
}
};
},
},
/**
* The data source object for the grid.
*
* @property data
* @type {Data}
*/
data: {
type: Object,
readOnly: true,
value: function() {
var _this = this;
return {
get source() {
return this._source;
},
set source(source) {
var sourceFunction = source;
if (Array.isArray(source)) {
sourceFunction = function(req) {
var array = source.slice(req.index, req.index + req.count);
req.success(array, source.length);
};
}
_this._grid.setDataSource(sourceFunction);
this._source = source;
},
get sortOrder() {
return _this._grid.getSortOrder();
},
set sortOrder(sortOrder) {
_this._grid.setSortOrder(sortOrder);
},
clearCache: function(estimatedNewSize) {
_this._grid.getDataSource().clearCache(estimatedNewSize);
},
};
}
},
/**
* Object for manipulating header rows
*
* @property header
* @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);
},
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 manipulating footer rows
*
* @property 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);
},
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();
}
};
}
},
/**
* Selection model
*
* @property selection
* @type {Selection}
*/
selection: {
type: Object,
readOnly: true,
value: function() {
var _this = this;
return {
select: function(index) {
_this._grid.getSelectionModel().select(index);
return _this;
},
deselect: function(index) {
_this._grid.getSelectionModel().deselect(index);
return _this;
},
clear: function() {
_this._grid.getSelectionModel().clear();
return _this;
},
selectAll: function() {
_this._grid.getSelectionModel().selectAll();
return _this;
},
selected: function(mapper, from, to) {
return _this._grid.getSelectionModel().selected(mapper, from, to);
},
deselected: function(mapper, from, to) {
return _this._grid.getSelectionModel().deselected(mapper, from, to);
},
get size() {
return _this._grid.getSelectionModel().size();
},
get mode() {
return _this._grid.getSelectionMode();
},
set mode(mode) {
_this._grid.setSelectionMode(mode);
_this.serializeValueToAttribute(_this.selection.mode, "selection-mode");
}
};
}
},
},
attributeChanged: function(name, type, value) {
switch (name) {
case 'disabled':
this.disabled = typeof value == "string";
break;
case 'editable':
this.editable = typeof value == "string";
break;
case 'style':
this._grid.redraw();
break;
case 'selection-mode':
this.selection.mode = value;
break;
default:
this[Polymer.CaseMap.dashToCamelCase(name)] = value;
}
},
listeners: {
/**
* @event sort
*/
/**
* @event select
*/
/**
* @event selectionmodechange
*/
'selectionmodechange': 'onSelectionModeChange'
},
onSelectionModeChange: function() {
this.serializeValueToAttribute(this.selection.mode, "selection-mode");
},
created: function() {
this._grid = new vaadin.GridComponent();
},
ready: function() {
var _this = this;
setTimeout(function() {
for (var i = 0; i < _this.attributes.length; i++) {
_this.attributeChanged(_this.attributes[i].nodeName, null, _this.attributes[i].nodeValue);
}
}, 1);
},
_bindResizeListener: function() {
var _this = this;
this.$.measureobject.addEventListener("load", function() {
this.contentDocument.defaultView.addEventListener('resize', function(e) {
_this._grid.redraw();
});
_this.then(function() {
// ...because one then just isn't enough.
_this.then(function() {
_this._grid.redraw();
});
});
});
this.$.measureobject.data = "about:blank";
},
attached: function() {
var _this = this;
this._grid.attached(this, Polymer.dom(this).querySelector("table"), Polymer.dom(this.root));
this._bindResizeListener();
// hide until fully loaded
this.toggleClass('loading', true);
this.then(function() {
_this.toggleClass('loading', false);
});
},
/**
* Scrolls to a certain row, using user-specified scroll destination.
* Since its asynchronous nature, this method returns a 'thenable'
* so as you can use the 'then()' method to be notified when the data
* request finished and the scroll is actually moved.
*
* @method scrollToRow
* @param {number} index - zero-based index of the row to scroll to.
* @param {string} scrollDestination - desired destination placement of scrolled-to-row.
*/
scrollToRow: function(index, scrollDestination) {
this._grid.scrollToRow(index, scrollDestination);
return this;
},
/**
* Scrolls to the beginning of the very first row.
* Since its asynchronous nature, this method returns a 'thenable'
* so as you can use the 'then()' method to be notified when the data
* request finished and the scroll is actually moved.
*
* @method scrollToStart
*/
scrollToStart: function() {
this._grid.scrollToStart();
return this;
},
/**
* Scrolls to the end of the very last row.
* Since its asynchronous nature, this method returns a 'thenable'
* so as you can use the 'then()' method to be notified when the data
* request finished and the scroll is actually moved.
*
* @method scrollToEnd
*/
scrollToEnd: function() {
this._grid.scrollToEnd();
return this;
},
/**
* Adds new column
*
* @method addColumn
* @param {Column} column
* @param {string} beforeColumn
*/
addColumn: function(column, beforeColumn) {
this._grid.addColumn(column, beforeColumn);
},
/**
* Removes column with certain id
*
* @method removeColumn
* @param {string} id
*/
removeColumn: function(id) {
this._grid.removeColumn(id);
},
/**
* Sets the style generator that is used for generating styles for rows.
*
* @attribute rowClassGenerator
* @type object
*/
get rowClassGenerator() {
return this._grid.getRowClassGenerator();
},
set rowClassGenerator(rowClassGenerator) {
this._grid.setRowClassGenerator(rowClassGenerator);
},
/**
* Sets the style generator that is used for generating styles for cells.
*
* @attribute cellClassGenerator
* @type object
*/
get cellClassGenerator() {
return this._grid.getCellClassGenerator();
},
set cellClassGenerator(cellClassGenerator) {
this._grid.setCellClassGenerator(cellClassGenerator);
},
/**
* Disables the grid functionality.
*
* @attribute disabled
* @type boolean
*/
get disabled() {
return this._grid.isDisabled();
},
set disabled(disabled) {
this._grid.setDisabled(disabled);
this.reflectPropertyToAttribute("disabled");
},
/**
* Enables the row editor feature (double click/tap or or Enter key in a content row activates the editing mode)
*
* @attribute editable
* @type boolean
*/
get editable() {
return this.editor.enabled;
},
set editable(editable) {
this.editor.enabled = editable;
this.reflectPropertyToAttribute("editable");
},
/**
* Sets the number of frozen columns in this grid. Setting the count to 0
* means that no data 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 also disable the selection column.
*
* @attribute frozen-columns
* @type Number
*/
get frozenColumns() {
return this._grid.getFrozenColumns();
},
set frozenColumns(frozenColumns) {
this._grid.setFrozenColumns(frozenColumns);
this.reflectPropertyToAttribute("frozenColumns");
},
/**
* Declares the number of visible rows in the grid. Implicitly sets the height
* in the inline style, overriding any previous height. Setting style.height
* in this case should be ignored if possible.
*
* @attribute rows
* @type Number
*/
get rows() {
return this._grid.getRows();
},
set rows(rows) {
this._grid.setRows(rows);
this.reflectPropertyToAttribute("rows");
},
/**
* The columns array
*
* @property columns
* @type {Array<Column>}
*/
get columns() {
return this._grid.getColumns();
},
set columns(cols) {
this._grid.setColumns(cols);
},
/**
* Executes a callback when the grid has finished any pending work.
*
* @method them
* @param {Function} callback
* @return a chainable promise
*/
then: function(cb) {
return this._grid.then(cb);
}
}); // End Polymer prototype
// Give some time to gwt async processes to run (we need this in FF)
setTimeout(function() {
vaadin._v_grid_ready = true;
document.dispatchEvent(new CustomEvent('v-grid-ready'));
}, 5);
} // End loadComponent function
if (window.vaadin && window.vaadin.GridComponent) {
loadComponent();
} else {
document.addEventListener("v-grid-loaded", function() {
loadComponent();
});
}
</script>
|