all files / grid/renderer/ content-renderer.js

92.66% Statements 656/708
86.01% Branches 535/622
100% Functions 72/72
92.59% Lines 650/702
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058   1377× 1377× 1377× 1377× 1377× 1377× 1377× 1377× 1377×   1377× 1377× 1377× 1377× 1377× 1377× 1377× 1377× 1377× 1910× 1910× 1921× 1921× 99×   1822× 1822× 101× 10× 338×     101× 101× 101× 16× 16× 16× 16× 16× 55× 55×         1822× 1813× 12× 12×   1813×   1813× 1058×   1813× 1813× 1813×   1813×   1813×             1810× 1808× 39×       1811× 38×       38×       1811× 1811× 1811× 1811× 10× 10×     1811× 1811×       1377× 1377× 1377× 1377× 1377× 1377× 1377×     1377×   1169×   1377× 1377× 1377× 1377× 1377×   2637× 33×     2604×     1197× 1197× 1197×   1192× 1192×     1192× 1192×   1192× 1192× 1192×     12× 12×   1201× 1201× 1201× 1201×   1201× 1201× 1201× 129×       1201× 1201× 74×     1280× 1280×   1280×             1280× 1280× 1280× 1280× 1280×   1914× 1914× 1914× 1914×   1912×     1912× 1912× 1912× 1912× 1090×   1912× 1912× 1912× 1912×   1912× 1912× 1912× 1912× 1912× 1912×   1912× 1912× 1912× 1912× 1912× 1912× 1912× 1912× 1912× 25× 187×     1912× 1912× 1912× 1909×   1910× 1910× 1910× 1910× 1910×                         1910×                 1910× 46× 46×   1910× 1910× 1910× 1910× 25× 25×   25× 305× 21×                       1910×   1910×               1910× 1910× 32×     1910×   1910× 43356× 43356× 772×   772× 772× 99×     43257× 43257×     335×   43249× 43190× 43190× 43190× 43190×   189×     43001×   43190× 43190× 98×   43190× 3596×       59× 59× 59×                           55×   55× 21× 21× 21× 21×     21×     20×       34×       34× 34×   34×     55× 55×   43245×   38685×       38685×     43245×   1910× 1910× 43356× 43356×   1910× 1910×     1910× 10×     1910× 32×         1910× 1910× 1910×   112× 112×     111× 111×   112× 70×     1910× 1910× 1910× 1910×   1723× 1718×   1723× 1722×       1722×   1909×   1909×   101× 101× 101×         92×       1808× 1808×   1890×     1890× 1890× 15× 14×   14× 14×   14×   13×     1880× 27×   1879×     8723×   49×     1654× 1654×     1653× 1653×   1654×   60× 60× 60×           1654×       1111× 1109×       1910× 39×     43191×         292×   1912× 16× 16×   16×   1896×             1894×   43258×   3888×                       1910×           17531× 17531× 425× 131× 131× 382×       294×     17531×       40215×   1277×   105607×   1281×   17523× 17523×   1655×   106×   2975×   1881× 1880×   1881×   62× 62× 62× 65× 60× 65× 62× 62× 55×   62× 62× 62× 62× 850× 62× 81× 81× 81× 81× 81× 80×   81× 75×   81×     81×   62×     55× 55×         82× 82×   64× 64×         64×   530× 529× 529× 529×     529×     1201× 1201×         1127× 1126×           1296×   1233× 1233× 72×     3331× 95226× 3331× 51069× 51069× 51069× 248357×       9362× 9362×   9362× 170× 170× 170×   170×   9362×   48×   120×     106×                                                               42× 42×                                   38× 38× 38× 38× 38× 38× 38×                 27×                                               40× 40× 20×     20×   40× 40× 40× 40× 40× 40×   40× 162×          
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "./row-renderer", "./cell-merge-renderer", "../services/row-model-generator", "../services/group-model-generator", "../base/util", "../base/string-literals"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, events, row_renderer_1, cell_merge_renderer_1, row_model_generator_1, group_model_generator_1, util_2, literals) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ContentRender = (function () {
        function ContentRender(parent, serviceLocator) {
            var _this = this;
            this.rows = [];
            this.freezeRows = [];
            this.movableRows = [];
            this.freezeRowElements = [];
            this.currentInfo = {};
            this.prevCurrentView = [];
            this.isLoaded = true;
            this.drop = function (e) {
                _this.parent.notify(events.columnDrop, { target: e.target, droppedElement: e.droppedElement });
                ej2_base_3.remove(e.droppedElement);
            };
            this.infiniteCache = {};
            this.visibleRows = [];
            this.visibleFrozenRows = [];
            this.rightFreezeRows = [];
            this.isAddRows = false;
            this.isInfiniteFreeze = false;
            this.useGroupCache = false;
            this.tempFreezeRows = [];
            this.rafCallback = function (args) {
                var arg = args;
                return function () {
                    _this.ariaService.setBusy(_this.getPanel().querySelector('.' + literals.content), false);
                    if (_this.parent.isDestroyed) {
                        return;
                    }
                    var rows = _this.rows.slice(0);
                    if (_this.parent.enableInfiniteScrolling) {
                        if (_this.parent.groupSettings.enableLazyLoading) {
                            for (var i = 0; i < _this.visibleRows.length; i++) {
                                _this.setRowsInLazyGroup(_this.visibleRows[parseInt(i.toString(), 10)], i);
                            }
                        }
                        rows = _this.parent.getRowsObject();
                        var prevPage = arg.prevPage;
                        if (_this.parent.infiniteScrollSettings.enableCache && prevPage) {
                            var maxBlock = _this.parent.infiniteScrollSettings.maxBlocks;
                            rows = [];
                            var rowIdx = (parseInt(_this.rowElements[0].getAttribute('data-rowindex'), 10) + 1);
                            var startIdx = Math.ceil(rowIdx / _this.parent.pageSettings.pageSize);
                            for (var i = 0, count = startIdx; i < maxBlock; i++, count++) {
                                Eif (_this.infiniteCache[parseInt(count.toString(), 10)]) {
                                    rows = rows.concat(_this.infiniteCache[parseInt(count.toString(), 10)]);
                                }
                            }
                        }
                    }
                    _this.parent.notify(events.contentReady, { rows: rows, args: arg });
                    if (_this.parent.editSettings.showAddNewRow && _this.parent.addNewRowFocus) {
                        _this.parent.notify(events.showAddNewRowFocus, {});
                        _this.parent.addNewRowFocus = false;
                    }
                    if (_this.parent.autoFit) {
                        _this.parent.preventAdjustColumns();
                    }
                    if (!_this.parent.isInitialLoad) {
                        _this.parent.focusModule.setFirstFocusableTabIndex();
                    }
                    Eif (_this.isLoaded) {
                        _this.parent.isManualRefresh = false;
                        if (_this.parent.enableInfiniteScrolling && _this.parent.groupSettings.enableLazyLoading && args.requestType === 'sorting') {
                            _this.parent.infiniteScrollModule['groupCaptionAction'] = undefined;
                        }
                        var isReactChild = _this.parent.parentDetails && _this.parent.parentDetails.parentInstObj &&
                            _this.parent.parentDetails.parentInstObj.isReact;
                        if ((_this.parent.isReact || isReactChild) && _this.parent.element.querySelectorAll('.e-templatecell').length) {
                            var thisRef_1 = _this;
                            thisRef_1.parent.renderTemplates(function () {
                                thisRef_1.parent.trigger(events.dataBound, {}, function () {
                                    Iif (thisRef_1.parent.allowTextWrap) {
                                        thisRef_1.parent.notify(events.freezeRender, { case: 'textwrap' });
                                    }
                                });
                            });
                        }
                        else {
                            _this.parent.trigger(events.dataBound, {}, function () {
                                if (_this.parent.allowTextWrap) {
                                    _this.parent.notify(events.freezeRender, { case: 'textwrap' });
                                }
                            });
                        }
                        if (_this.parent.allowTextWrap && _this.parent.height === 'auto') {
                            Iif (_this.parent.getContentTable().scrollHeight > _this.parent.getContent().clientHeight) {
                                _this.parent.scrollModule.setPadding();
                            }
                            else {
                                _this.parent.scrollModule.removePadding();
                            }
                        }
                    }
                    Eif (arg) {
                        var action = (arg.requestType || '').toLowerCase() + '-complete';
                        _this.parent.notify(action, arg);
                        if (args.requestType === 'batchsave') {
                            args.cancel = false;
                            _this.parent.trigger(events.actionComplete, args);
                        }
                    }
                    Eif (_this.isLoaded) {
                        _this.parent.hideSpinner();
                    }
                };
            };
            this.parent = parent;
            this.serviceLocator = serviceLocator;
            this.widthService = serviceLocator.getService('widthService');
            this.ariaService = this.serviceLocator.getService('ariaService');
            this.parent.enableDeepCompare = this.parent.getDataModule().isRemote();
            this.generator = this.getModelGenerator();
            Iif (this.parent.isDestroyed) {
                return;
            }
            if (!this.parent.enableColumnVirtualization && !this.parent.enableVirtualization
                && !this.parent.groupSettings.enableLazyLoading) {
                this.parent.on(events.columnVisibilityChanged, this.setVisible, this);
            }
            this.parent.on(events.colGroupRefresh, this.colGroupRefresh, this);
            this.parent.on(events.uiUpdate, this.enableAfterRender, this);
            this.parent.on(events.refreshInfiniteModeBlocks, this.refreshContentRows, this);
            this.parent.on(events.beforeCellFocused, this.beforeCellFocused, this);
            this.parent.on(events.destroy, this.droppableDestroy, this);
        }
        ContentRender.prototype.beforeCellFocused = function (e) {
            if (e.byKey && (e.keyArgs.action === 'upArrow' || e.keyArgs.action === 'downArrow')) {
                this.pressedKey = e.keyArgs.action;
            }
            else {
                this.pressedKey = undefined;
            }
        };
        ContentRender.prototype.renderPanel = function () {
            var gObj = this.parent;
            var div = this.parent.element.querySelector('.' + literals.gridContent);
            if (div) {
                this.ariaService.setOptions(this.parent.element.querySelector('.' + literals.content), { busy: false });
                this.setPanel(div);
                return;
            }
            div = this.parent.createElement('div', { className: literals.gridContent });
            var innerDiv = this.parent.createElement('div', {
                className: literals.content
            });
            this.ariaService.setOptions(innerDiv, { busy: false });
            if (this.parent.enableColumnVirtualization && this.parent.isFrozenGrid()) {
                this.renderHorizontalScrollbar(div);
                innerDiv.classList.add('e-virtual-content');
            }
            div.appendChild(innerDiv);
            this.setPanel(div);
            gObj.element.appendChild(div);
        };
        ContentRender.prototype.renderHorizontalScrollbar = function (element) {
            var parent = this.parent.createElement('div', { className: 'e-movablescrollbar' });
            var child = this.parent.createElement('div', { className: 'e-movablechild' });
            var scrollbarHeight = util_1.getScrollBarWidth().toString();
            this.setScrollbarHeight(child, scrollbarHeight);
            this.setScrollbarHeight(parent, scrollbarHeight);
            parent.appendChild(child);
            element.appendChild(parent);
        };
        ContentRender.prototype.setScrollbarHeight = function (ele, height) {
            ele.style.minHeight = height + 'px';
            ele.style.maxHeight = height + 'px';
        };
        ContentRender.prototype.renderTable = function () {
            var contentDiv = this.getPanel();
            var virtualTable = contentDiv.querySelector('.e-virtualtable');
            var virtualTrack = contentDiv.querySelector('.e-virtualtrack');
            if (this.parent.enableVirtualization && !ej2_base_2.isNullOrUndefined(virtualTable) && !ej2_base_2.isNullOrUndefined(virtualTrack)) {
                ej2_base_3.remove(virtualTable);
                ej2_base_3.remove(virtualTrack);
            }
            contentDiv.appendChild(this.createContentTable('_content_table'));
            this.setTable(contentDiv.querySelector('.' + literals.table));
            if (this.parent.selectionSettings.type === 'Multiple') {
                this.ariaService.setOptions(this.parent.element, {
                    multiselectable: true
                });
            }
            this.initializeContentDrop();
            if (this.parent.frozenRows) {
                this.parent.getHeaderContent().classList.add('e-frozenhdr');
            }
        };
        ContentRender.prototype.createContentTable = function (id) {
            var innerDiv = this.getPanel().firstElementChild;
            if (this.getTable()) {
                ej2_base_3.remove(this.getTable());
            }
            var table = innerDiv.querySelector('.' + literals.table) ? innerDiv.querySelector('.' + literals.table) :
                this.parent.createElement('table', {
                    className: literals.table, attrs: {
                        cellspacing: '0.25px', role: 'presentation',
                        id: this.parent.element.id + id
                    }
                });
            this.setColGroup(this.parent.getHeaderTable().querySelector(literals.colGroup).cloneNode(true));
            table.appendChild(this.getColGroup());
            table.appendChild(this.parent.createElement(literals.tbody, { attrs: { role: 'rowgroup' } }));
            innerDiv.appendChild(table);
            return innerDiv;
        };
        ContentRender.prototype.refreshContentRows = function (args) {
            var _this = this;
            if (args === void 0) { args = {}; }
            var gObj = this.parent;
            if (gObj.currentViewData.length === 0) {
                return;
            }
            if (gObj.editSettings && gObj.editModule && gObj.editSettings.mode === 'Batch' && gObj.editModule.formObj
                && gObj.editSettings.showConfirmDialog === false) {
                gObj.editModule.destroyForm();
            }
            var dataSource = this.currentMovableRows || gObj.currentViewData;
            var isReact = gObj.isReact && !ej2_base_2.isNullOrUndefined(gObj.rowTemplate);
            var frag = isReact ? gObj.createElement(literals.tbody, { attrs: { role: 'rowgroup' } }) : document.createDocumentFragment();
            if (!this.initialPageRecords) {
                this.initialPageRecords = ej2_base_2.extend([], dataSource);
            }
            var hdrfrag = isReact ? gObj.createElement(literals.tbody, { attrs: { role: 'rowgroup' } }) : document.createDocumentFragment();
            var refFrag;
            var refHdrfrag;
            if (gObj.isReact && gObj.rowTemplate) {
                refFrag = frag;
                refHdrfrag = hdrfrag;
            }
            var columns = gObj.getColumns();
            var tr;
            var hdrTbody;
            var trElement;
            var row = new row_renderer_1.RowRenderer(this.serviceLocator, null, this.parent);
            var isInfiniteScroll = this.parent.enableInfiniteScrolling
                && args.requestType === 'infiniteScroll';
            var isColumnVirtualInfiniteProcess = this.isInfiniteColumnvirtualization() && args.requestType !== 'virtualscroll';
            gObj.notify(events.destroyChildGrid, {});
            this.rowElements = [];
            this.rows = [];
            this.tempFreezeRows = [];
            var tbdy;
            var tableName;
            var isGroupFrozenHdr = this.parent.frozenRows && this.parent.groupSettings.columns.length ? true : false;
            if (util_2.isGroupAdaptive(gObj)) {
                if (['sorting', 'filtering', 'searching', 'grouping', 'ungrouping', 'reorder', 'save', 'delete']
                    .some(function (value) { return args.requestType === value; })) {
                    this.emptyVcRows();
                }
            }
            var modelData;
            modelData = this.checkCache(modelData, args);
            if (!this.isAddRows && !this.useGroupCache) {
                modelData = this.generator.generateRows(dataSource, args);
            }
            this.setGroupCache(modelData, args);
            this.parent.notify(events.setInfiniteCache, { isInfiniteScroll: isInfiniteScroll, modelData: modelData, args: args });
            var isFrozenLeft = false;
            var registeredTemplates = this.parent.registeredTemplate;
            Iif (!(args.requestType === 'infiniteScroll' && !this.parent.infiniteScrollSettings.enableCache) && registeredTemplates
                && registeredTemplates.template && !args.isFrozen && !isFrozenLeft) {
                var templatetoclear = [];
                for (var i = 0; i < registeredTemplates.template.length; i++) {
                    for (var j = 0; j < registeredTemplates.template[parseInt(i.toString(), 10)].rootNodes.length; j++) {
                        if (ej2_base_2.isNullOrUndefined(registeredTemplates.template[parseInt(i.toString(), 10)]
                            .rootNodes[parseInt(j.toString(), 10)].parentNode)) {
                            templatetoclear.push(registeredTemplates.template[parseInt(i.toString(), 10)]);
                        }
                    }
                }
                this.parent.destroyTemplate(['template'], templatetoclear);
            }
            if ((this.parent.isReact || this.parent.isVue) && !(args.requestType === 'infiniteScroll' && !this.parent.infiniteScrollSettings.enableCache) && !args.isFrozen) {
                var templates = [
                    this.parent.isVue ? 'template' : 'columnTemplate', 'rowTemplate', 'detailTemplate',
                    'captionTemplate', 'commandsTemplate', 'groupFooterTemplate', 'groupCaptionTemplate'
                ];
                Iif (args.requestType === 'infiniteScroll' && this.parent.infiniteScrollSettings.enableCache) {
                    templates = [
                        this.parent.isVue ? 'template' : 'columnTemplate', 'commandsTemplate'
                    ];
                }
                util_1.clearReactVueTemplates(this.parent, templates);
            }
            if (this.parent.enableColumnVirtualization) {
                var cellMerge = new cell_merge_renderer_1.CellMergeRender(this.serviceLocator, this.parent);
                cellMerge.updateVirtualCells(modelData);
            }
            this.tbody = this.getTable().querySelector(literals.tbody);
            var startIndex = 0;
            var blockLoad = true;
            if (util_2.isGroupAdaptive(gObj) && gObj.vcRows.length) {
                var top_1 = 'top';
                var scrollTop = !ej2_base_2.isNullOrUndefined(args.virtualInfo.offsets) ? args.virtualInfo.offsets.top :
                    (!ej2_base_2.isNullOrUndefined(args.scrollTop) ? args.scrollTop["" + top_1] : 0);
                if (scrollTop !== 0) {
                    var offsets_1 = gObj.vGroupOffsets;
                    var bSize = gObj.pageSettings.pageSize / 2;
                    var values = Object.keys(offsets_1).map(function (key) { return offsets_1["" + key]; });
                    for (var m = 0; m < values.length; m++) {
                        if (scrollTop < values[parseInt(m.toString(), 10)]) {
                            if (!ej2_base_2.isNullOrUndefined(args.virtualInfo) && args.virtualInfo.direction === 'up') {
                                startIndex = m > 0 ? ((m - 1) * bSize) : (m * bSize);
                                break;
                            }
                            else {
                                startIndex = m * bSize;
                                if (this.parent.contentModule.isEndBlock(m) || this.parent.contentModule.isEndBlock(m + 1)) {
                                    args.virtualInfo.blockIndexes = [m, m + 1];
                                }
                                break;
                            }
                        }
                    }
                    Iif (Math.round(scrollTop + this.contentPanel.firstElementChild.offsetHeight) >=
                        this.contentPanel.firstElementChild.scrollHeight && !args.rowObject) {
                        blockLoad = false;
                    }
                }
            }
            var isVFFrozenOnly = gObj.frozenRows && this.parent.enableVirtualization
                && args.requestType === 'reorder';
            if ((gObj.frozenRows && args.requestType === 'virtualscroll' && args.virtualInfo.sentinelInfo.axis === 'X') || isVFFrozenOnly) {
                var bIndex = args.virtualInfo.blockIndexes;
                var page = args.virtualInfo.page;
                args.virtualInfo.blockIndexes = [1, 2];
                Iif (isVFFrozenOnly) {
                    args.virtualInfo.page = 1;
                }
                var data = isVFFrozenOnly ? this.initialPageRecords : dataSource;
                var mhdrData = this.vgenerator
                    .generateRows(data, args);
                mhdrData.splice(this.parent.frozenRows);
                for (var i = 0; i < this.parent.frozenRows; i++) {
                    tr = row.render(mhdrData[parseInt(i.toString(), 10)], columns);
                    util_2.addFixedColumnBorder(tr);
                    hdrfrag.appendChild(tr);
                }
                args.virtualInfo.blockIndexes = bIndex;
                args.virtualInfo.page = page;
                Iif (isVFFrozenOnly && args.virtualInfo.page === 1) {
                    modelData.splice(0, this.parent.frozenRows);
                }
            }
            this.virtualFrozenHdrRefresh(hdrfrag, modelData, row, args, dataSource, columns);
            if (this.parent.groupSettings.enableLazyLoading && !this.useGroupCache && this.parent.groupSettings.columns.length) {
                (this.parent.enableVirtualization ? this.parent.lazyLoadRender :
                    this.parent.contentModule).refRowsObj[this.parent.pageSettings.currentPage] = [];
            }
            if (this.parent.enableInfiniteScrolling && this.parent.groupSettings.enableLazyLoading && args.requestType === 'delete') {
                this.visibleRows = [];
            }
            var _loop_1 = function (i, len) {
                this_1.rows.push(modelData[parseInt(i.toString(), 10)]);
                if (this_1.parent.groupSettings.enableLazyLoading && !this_1.useGroupCache && this_1.parent.groupSettings.columns.length) {
                    (this_1.parent.enableVirtualization ? this_1.parent.lazyLoadRender :
                        this_1.parent.contentModule).refRowsObj[this_1.parent.pageSettings.currentPage].push(modelData[parseInt(i.toString(), 10)]);
                    this_1.setRowsInLazyGroup(modelData[parseInt(i.toString(), 10)], i);
                    if (ej2_base_2.isNullOrUndefined(modelData[parseInt(i.toString(), 10)].indent)) {
                        return "continue";
                    }
                }
                this_1.setInfiniteVisibleRows(args, modelData[parseInt(i.toString(), 10)]);
                if (util_2.isGroupAdaptive(gObj) && args.virtualInfo && args.virtualInfo.blockIndexes
                    && (this_1.rowElements.length >= (args.virtualInfo.blockIndexes.length * this_1.parent.contentModule.getBlockSize()))
                    && blockLoad) {
                    this_1.parent.currentViewData['records'] = this_1.rows.map(function (m) { return m.data; });
                    return "break";
                }
                if (!gObj.rowTemplate) {
                    tr = row.render(modelData[parseInt(i.toString(), 10)], columns);
                    util_2.addFixedColumnBorder(tr);
                    var isVFreorder = this_1.ensureFrozenHeaderRender(args);
                    if (gObj.frozenRows && (i < gObj.frozenRows || isGroupFrozenHdr) && !isInfiniteScroll && args.requestType !== 'virtualscroll' && isVFreorder
                        && this_1.ensureVirtualFrozenHeaderRender(args)) {
                        hdrfrag.appendChild(tr);
                    }
                    else {
                        frag.appendChild(tr);
                    }
                    var rowIdx = parseInt(tr.getAttribute('data-rowindex'), 10);
                    if (rowIdx + 1 === gObj.frozenRows) {
                        isGroupFrozenHdr = false;
                    }
                    if (modelData[parseInt(i.toString(), 10)].isExpand) {
                        gObj.notify(events.expandChildGrid, tr.cells[gObj.groupSettings.columns.length]);
                    }
                }
                else {
                    var rowTemplateID = gObj.element.id + 'rowTemplate';
                    var elements = void 0;
                    if (gObj.isReact) {
                        var isHeader = gObj.frozenRows && i < gObj.frozenRows;
                        var copied = ej2_base_2.extend({ index: i }, dataSource[parseInt(i.toString(), 10)]);
                        gObj.getRowTemplate()(copied, gObj, 'rowTemplate', rowTemplateID, null, null, isHeader ? hdrfrag : frag);
                        Eif (gObj.requireTemplateRef) {
                            var thisRef_2 = this_1;
                            thisRef_2.parent.renderTemplates(function () {
                                if (gObj.frozenRows && i < gObj.frozenRows) {
                                    tr = refHdrfrag.childNodes[parseInt(i.toString(), 10)];
                                }
                                else {
                                    trElement = refFrag.childNodes[parseInt(i.toString(), 10)];
                                }
                                var arg = { data: modelData[parseInt(i.toString(), 10)].data,
                                    row: trElement ? trElement : tr };
                                thisRef_2.parent.trigger(events.rowDataBound, arg);
                                Eif (modelData[parseInt(i.toString(), 10)].isDataRow || (thisRef_2.parent.enableVirtualization &&
                                    thisRef_2.parent.groupSettings.enableLazyLoading)) {
                                    thisRef_2.rowElements.push(arg.row);
                                }
                                thisRef_2.ariaService.setOptions(thisRef_2.parent.element, {
                                    colcount: gObj.getColumns().length.toString()
                                });
                                if (i === modelData.length - 1) {
                                    refFrag = null;
                                    refHdrfrag = null;
                                }
                            });
                            return "continue";
                        }
                    }
                    else {
                        elements = gObj.getRowTemplate()(ej2_base_2.extend({ index: i }, dataSource[parseInt(i.toString(), 10)]), gObj, 'rowTemplate', rowTemplateID, undefined, undefined, undefined, this_1.parent['root']);
                    }
                    if (!gObj.isReact && elements[0].tagName === 'TBODY') {
                        for (var j = 0; j < elements.length; j++) {
                            var isTR = elements[parseInt(j.toString(), 10)].nodeName.toLowerCase() === 'tr';
                            Eif (isTR || (elements[parseInt(j.toString(), 10)].querySelectorAll && elements[parseInt(j.toString(), 10)].querySelectorAll('tr').length)) {
                                tr = isTR ? elements[parseInt(j.toString(), 10)] : elements[parseInt(j.toString(), 10)].querySelector('tr');
                            }
                        }
                        if (gObj.frozenRows && i < gObj.frozenRows) {
                            hdrfrag.appendChild(tr);
                        }
                        else {
                            frag.appendChild(tr);
                        }
                    }
                    else {
                        Iif (gObj.frozenRows && i < gObj.frozenRows) {
                            tr = !gObj.isReact ? util_1.appendChildren(hdrfrag, elements) : hdrfrag.lastElementChild;
                        }
                        else {
                            Eif (!gObj.isReact) {
                                tr = util_1.appendChildren(frag, elements);
                            }
                            trElement = gObj.isReact ? frag.lastElementChild : tr.lastElementChild;
                        }
                    }
                    var arg = { data: modelData[parseInt(i.toString(), 10)].data, row: trElement ? trElement : tr };
                    this_1.parent.trigger(events.rowDataBound, arg);
                }
                if (modelData[parseInt(i.toString(), 10)].isDataRow || (this_1.parent.enableVirtualization &&
                    this_1.parent.groupSettings.enableLazyLoading)) {
                    Iif (!ej2_base_2.isNullOrUndefined(gObj.rowTemplate) && (gObj.isAngular || gObj.isVue3 || gObj.isVue)) {
                        this_1.rowElements.push(trElement ? trElement : tr);
                    }
                    else {
                        this_1.rowElements.push(tr);
                    }
                }
                this_1.ariaService.setOptions(this_1.parent.element, { colcount: gObj.getColumns().length.toString() });
            };
            var this_1 = this;
            for (var i = startIndex, len = modelData.length; i < len; i++) {
                var state_1 = _loop_1(i, len);
                if (state_1 === "break")
                    break;
            }
            var isReactChild = gObj.parentDetails && gObj.parentDetails.parentInstObj && gObj.parentDetails.parentInstObj.isReact;
            Iif ((gObj.isReact || isReactChild) && !gObj.requireTemplateRef) {
                gObj.renderTemplates();
            }
            if (this.parent.enableInfiniteScrolling && this.parent.groupSettings.enableLazyLoading) {
                this.parent.contentModule.refRowsObj[this.parent.pageSettings.currentPage] =
                    this.parent.contentModule['groupCache'][this.parent.pageSettings.currentPage];
            }
            if (this.parent.groupSettings.enableLazyLoading && !this.useGroupCache && this.parent.groupSettings.columns.length) {
                this.parent.notify(events.refreshExpandandCollapse, {
                    rows: (this.parent.enableVirtualization ? this.parent.lazyLoadRender :
                        this.parent.contentModule).refRowsObj[this.parent.pageSettings.currentPage]
                });
            }
            gObj.removeMaskRow();
            this.parent.notify('removeGanttShimmer', { requestType: 'hideShimmer' });
            if ((gObj.frozenRows && args.requestType !== 'virtualscroll' && !isInfiniteScroll && this.ensureVirtualFrozenHeaderRender(args))
                || (args.requestType === 'virtualscroll' && args.virtualInfo.sentinelInfo && args.virtualInfo.sentinelInfo.axis === 'X')) {
                hdrTbody = gObj.getHeaderTable().querySelector(literals.tbody);
                if (isReact) {
                    var parentTable = hdrTbody.parentElement;
                    ej2_base_3.remove(hdrTbody);
                    parentTable.appendChild(hdrfrag);
                }
                else {
                    hdrTbody.innerHTML = '';
                    hdrTbody.appendChild(hdrfrag);
                }
                if (!gObj.isInitialLoad) {
                    gObj.scrollModule.setHeight();
                }
            }
            args.rows = this.rows.slice(0);
            util_1.getUpdateUsingRaf(function () {
                _this.parent.notify(events.beforeFragAppend, args);
                if (!_this.parent.enableVirtualization && (!_this.parent.enableColumnVirtualization || isColumnVirtualInfiniteProcess)
                    && !isInfiniteScroll) {
                    if (!gObj.isReact) {
                        _this.tbody.innerHTML = '';
                    }
                    if (!ej2_base_2.isNullOrUndefined(_this.tbody.parentElement)) {
                        ej2_base_3.remove(_this.tbody);
                    }
                    else {
                        ej2_base_3.remove(gObj.getContentTable().querySelector(literals.tbody));
                    }
                    _this.tbody = _this.parent.createElement(literals.tbody, { attrs: { role: 'rowgroup' } });
                }
                if (gObj.rowTemplate) {
                    ej2_base_3.updateBlazorTemplate(gObj.element.id + 'rowTemplate', 'RowTemplate', gObj);
                }
                if (!ej2_base_2.isNullOrUndefined(_this.parent.infiniteScrollModule) && ((_this.parent.enableInfiniteScrolling
                    && !_this.isInfiniteColumnvirtualization()) || isColumnVirtualInfiniteProcess)) {
                    _this.isAddRows = false;
                    _this.parent.notify(events.removeInfiniteRows, { args: args });
                    _this.parent.notify(events.appendInfiniteContent, {
                        tbody: tbdy ? tbdy : _this.tbody, frag: frag, args: args, rows: _this.rows,
                        rowElements: _this.rowElements, visibleRows: _this.visibleRows,
                        tableName: tableName
                    });
                    if (_this.isInfiniteColumnvirtualization() && _this.parent.isFrozenGrid()) {
                        var virtualTable = _this.parent.getContent().querySelector('.e-virtualtable');
                        var transform = util_1.getTransformValues(virtualTable);
                        _this.parent.contentModule.resetStickyLeftPos(transform.width);
                        _this.widthService.refreshFrozenScrollbar();
                    }
                }
                else {
                    _this.useGroupCache = false;
                    _this.appendContent(_this.tbody, frag, args);
                }
                if (_this.parent.editSettings.showAddNewRow && (_this.parent.enableVirtualization || _this.parent.enableInfiniteScrolling)) {
                    var newRow = _this.parent.element.querySelector('.e-addrow-removed');
                    if (newRow) {
                        ej2_base_3.remove(newRow);
                    }
                }
                var startAdd = !_this.parent.element.querySelector('.' + literals.addedRow);
                if (_this.parent.editSettings.showAddNewRow && _this.parent.editSettings.mode === 'Normal') {
                    if (startAdd) {
                        if (_this.parent.enableVirtualization || _this.parent.enableInfiniteScrolling) {
                            _this.parent.isAddNewRow = true;
                        }
                        _this.parent.isEdit = false;
                        _this.parent.addRecord();
                    }
                    if (startAdd || ((_this.parent.enableVirtualization || _this.parent.enableInfiniteScrolling) &&
                        ['sorting', 'filtering', 'searching', 'grouping', 'ungrouping', 'reorder']
                            .some(function (value) { return args.requestType === value; }))) {
                        _this.parent.notify(events.showAddNewRowFocus, {});
                    }
                }
                if (_this.parent.getVisibleFrozenRightCount() && _this.parent.getContent() && util_1.getScrollWidth(_this.parent) > 0) {
                    _this.parent.element.classList.add('e-right-shadow');
                }
                frag = null;
            }, this.rafCallback(ej2_base_2.extend({}, args)));
        };
        ContentRender.prototype.isInfiniteColumnvirtualization = function () {
            return this.parent.enableColumnVirtualization && this.parent.enableInfiniteScrolling;
        };
        ContentRender.prototype.enableCacheOnInfiniteColumnVirtual = function () {
            return this.isInfiniteColumnvirtualization() && this.parent.infiniteScrollSettings.enableCache;
        };
        ContentRender.prototype.emptyVcRows = function () {
            this.parent.vcRows = [];
            this.parent.vRows = [];
        };
        ContentRender.prototype.appendContent = function (tbody, frag, args, tableName) {
            var isReact = this.parent.isReact && !ej2_base_2.isNullOrUndefined(this.parent.rowTemplate);
            if (isReact) {
                this.getTable().appendChild(frag);
            }
            else {
                tbody.appendChild(frag);
                this.getTable().appendChild(tbody);
            }
            if (this.parent.rowRenderingMode === 'Vertical' && this.parent.allowTextWrap && (this.parent.textWrapSettings.wrapMode === 'Header'
                || this.parent.textWrapSettings.wrapMode === 'Both')) {
                var cells = tbody.querySelectorAll('td');
                for (var i = 0; i < cells.length; i++) {
                    var headerCellHeight = parseFloat(document.defaultView.getComputedStyle(cells[parseInt(i.toString(), 10)], '::before').getPropertyValue('height'));
                    var cellHeight = cells[parseInt(i.toString(), 10)].offsetHeight;
                    Iif (headerCellHeight > cellHeight) {
                        cells[parseInt(i.toString(), 10)].style.height = headerCellHeight + 'px';
                        cells[parseInt(i.toString(), 10)].style.boxSizing = 'content-box';
                    }
                }
            }
            Iif (this.parent.getVisibleFrozenLeftCount() && this.parent.enableColumnVirtualization) {
                this.widthService.refreshFrozenScrollbar();
            }
        };
        ContentRender.prototype.setRowsInLazyGroup = function (row, index) {
            if (this.parent.groupSettings.enableLazyLoading && !this.useGroupCache && this.parent.groupSettings.columns.length) {
                (this.parent.enableVirtualization ? this.parent.lazyLoadRender :
                    this.parent.contentModule).maintainRows(row, index);
            }
        };
        ContentRender.prototype.setGroupCache = function (data, args) {
            if (!this.useGroupCache && this.parent.groupSettings.enableLazyLoading) {
                this.parent.notify(events.setGroupCache, { args: args, data: data });
            }
        };
        ContentRender.prototype.ensureFrozenHeaderRender = function (args) {
            return !((this.parent.enableVirtualization
                && (args.requestType === 'reorder' || args.requestType === 'refresh')) || (this.parent.infiniteScrollSettings.enableCache
                && this.parent.frozenRows && this.parent.infiniteScrollModule.requestType === 'delete'
                && this.parent.pageSettings.currentPage !== 1));
        };
        ContentRender.prototype.ensureVirtualFrozenHeaderRender = function (args) {
            return !(this.parent.enableVirtualization && args.requestType === 'delete');
        };
        ContentRender.prototype.checkCache = function (modelData, args) {
            if (this.parent.infiniteScrollSettings.enableCache && args.requestType === 'infiniteScroll') {
                this.isAddRows = !ej2_base_2.isNullOrUndefined(this.infiniteCache[this.parent.pageSettings.currentPage]);
                if (this.isAddRows) {
                    var data = this.infiniteCache[this.parent.pageSettings.currentPage];
                    modelData = this.parent.pageSettings.currentPage === 1 ? data.slice(this.parent.frozenRows) : data;
                }
                return modelData;
            }
            if (this.parent.groupSettings.enableLazyLoading && this.parent.groupSettings.columns.length && (args.requestType === 'paging'
                || args.requestType === 'columnstate' || args.requestType === 'reorder' || args.requestType === 'virtualscroll')
                && (this.parent.enableVirtualization ? this.parent.lazyLoadRender :
                    this.parent.contentModule).getGroupCache()[this.parent.pageSettings.currentPage]) {
                Eif (!this.parent.enableVirtualization) {
                    this.useGroupCache = true;
                }
                return this.parent.enableVirtualization ? this.parent.getRowsObject() :
                    this.parent.contentModule.initialGroupRows(args.requestType === 'reorder');
            }
            return null;
        };
        ContentRender.prototype.setInfiniteVisibleRows = function (args, data) {
            if (this.parent.enableInfiniteScrolling && !this.parent.infiniteScrollSettings.enableCache
                && !(this.isInfiniteColumnvirtualization() && args.requestType === 'virtualscroll')) {
                this.visibleRows.push(data);
            }
        };
        ContentRender.prototype.getCurrentBlockInfiniteRecords = function () {
            var data = [];
            if (this.parent.infiniteScrollSettings.enableCache) {
                Iif (!Object.keys(this.infiniteCache).length) {
                    return [];
                }
                var rows = this.parent.getRows();
                var index = parseInt(rows[this.parent.frozenRows].getAttribute(literals.dataRowIndex), 10);
                var first = Math.ceil((index + 1) / this.parent.pageSettings.pageSize);
                index = parseInt(rows[rows.length - 1].getAttribute(literals.dataRowIndex), 10);
                var last = Math.ceil((index + (rows.length ? 1 : 0)) / this.parent.pageSettings.pageSize);
                for (var i = first; i <= last; i++) {
                    data = !data.length ? this.infiniteCache[parseInt(i.toString(), 10)]
                        : data.concat(this.infiniteCache[parseInt(i.toString(), 10)]);
                }
                Iif (this.parent.frozenRows && this.parent.pageSettings.currentPage > 1) {
                    data = this.infiniteCache[1].slice(0, this.parent.frozenRows).concat(data);
                }
            }
            return data;
        };
        ContentRender.prototype.getReorderedRows = function (args) {
            return this.parent.contentModule.getReorderedFrozenRows(args);
        };
        ContentRender.prototype.virtualFrozenHdrRefresh = function (hdrfrag, modelData, row, args, dataSource, columns) {
            if (this.parent.frozenRows && this.parent.enableVirtualization
                && (args.requestType === 'reorder' || args.requestType === 'refresh')) {
                var tr = void 0;
                var fhdrData = this.getReorderedRows(args);
                for (var i = 0; i < fhdrData.length; i++) {
                    tr = row.render(fhdrData[parseInt(i.toString(), 10)], columns);
                    hdrfrag.appendChild(tr);
                }
                Eif (args.virtualInfo.page === 1) {
                    modelData.splice(0, this.parent.frozenRows);
                }
            }
        };
        ContentRender.prototype.getInfiniteRows = function () {
            var rows = [];
            if (this.parent.enableInfiniteScrolling) {
                if (this.parent.infiniteScrollSettings.enableCache) {
                    var keys = Object.keys(this.infiniteCache);
                    for (var i = 0; i < keys.length; i++) {
                        rows = rows.concat(this.infiniteCache[keys[parseInt(i.toString(), 10)]]);
                    }
                }
                else {
                    rows = this.visibleRows;
                }
            }
            return rows;
        };
        ContentRender.prototype.getInfiniteMovableRows = function () {
            var infiniteCacheRows = this.getCurrentBlockInfiniteRecords();
            var infiniteRows = this.parent.enableInfiniteScrolling ? infiniteCacheRows.length ? infiniteCacheRows
                : this.visibleRows : [];
            return infiniteRows;
        };
        ContentRender.prototype.getPanel = function () {
            return this.contentPanel;
        };
        ContentRender.prototype.setPanel = function (panel) {
            this.contentPanel = panel;
        };
        ContentRender.prototype.getTable = function () {
            return this.contentTable;
        };
        ContentRender.prototype.setTable = function (table) {
            this.contentTable = table;
        };
        ContentRender.prototype.getRows = function () {
            var infiniteRows = this.getInfiniteRows();
            return infiniteRows.length ? infiniteRows : this.rows;
        };
        ContentRender.prototype.getRowElements = function () {
            return this.rowElements;
        };
        ContentRender.prototype.setRowElements = function (elements) {
            this.rowElements = elements;
        };
        ContentRender.prototype.getColGroup = function () {
            return this.colgroup;
        };
        ContentRender.prototype.setColGroup = function (colGroup) {
            if (!ej2_base_2.isNullOrUndefined(colGroup)) {
                colGroup.id = 'content-' + colGroup.id;
            }
            return this.colgroup = colGroup;
        };
        ContentRender.prototype.setVisible = function (columns) {
            var gObj = this.parent;
            var rows = this.getRows();
            var testRow;
            rows.some(function (r) { if (r.isDataRow) {
                testRow = r;
            } return r.isDataRow; });
            var needFullRefresh = true;
            if (!gObj.groupSettings.columns.length && testRow) {
                needFullRefresh = false;
            }
            var tr = gObj.getDataRows();
            var args = {};
            var infiniteData = this.infiniteRowVisibility();
            var contentrows = infiniteData ? infiniteData
                : this.rows.filter(function (row) { return !row.isDetailRow; });
            for (var c = 0, clen = columns.length; c < clen; c++) {
                var column = columns[parseInt(c.toString(), 10)];
                var idx = this.parent.getNormalizedColumnIndex(column.uid);
                var colIdx = this.parent.getColumnIndexByUid(column.uid);
                var displayVal = column.visible === true ? '' : 'none';
                if (idx !== -1 && testRow && idx < testRow.cells.length) {
                    ej2_base_3.setStyleAttribute(this.getColGroup().childNodes[parseInt(idx.toString(), 10)], { 'display': displayVal });
                }
                if (!needFullRefresh) {
                    this.setDisplayNone(tr, colIdx, displayVal, contentrows);
                }
                Iif (!this.parent.invokedFromMedia && column.hideAtMedia) {
                    this.parent.updateMediaColumns(column);
                }
                this.parent.invokedFromMedia = false;
            }
            if (needFullRefresh) {
                this.refreshContentRows({ requestType: 'refresh' });
            }
            else {
                this.parent.notify(events.partialRefresh, { rows: contentrows, args: args });
                Iif (this.parent.editSettings.showAddNewRow && (this.parent.enableVirtualization || this.parent.enableInfiniteScrolling)) {
                    this.parent.notify(events.showAddNewRowFocus, {});
                }
            }
        };
        ContentRender.prototype.setDisplayNone = function (tr, idx, displayVal, rows) {
            util_1.setDisplayValue(tr, idx, displayVal, rows, this.parent, this.parent.isRowDragable());
            this.parent.notify(events.infiniteShowHide, { visible: displayVal, index: idx, isFreeze: this.isInfiniteFreeze });
        };
        ContentRender.prototype.infiniteRowVisibility = function (isFreeze) {
            var infiniteData;
            if (this.parent.enableInfiniteScrolling) {
                this.isInfiniteFreeze = isFreeze;
                if (this.parent.infiniteScrollSettings.enableCache) {
                    infiniteData = this.getCurrentBlockInfiniteRecords();
                }
                else {
                    infiniteData = isFreeze ? this.visibleFrozenRows : this.visibleRows;
                }
            }
            return infiniteData;
        };
        ContentRender.prototype.colGroupRefresh = function () {
            if (this.getColGroup()) {
                var colGroup = this.getHeaderColGroup();
                this.getTable().replaceChild(colGroup, this.getColGroup());
                this.setColGroup(colGroup);
            }
        };
        ContentRender.prototype.getHeaderColGroup = function () {
            return this.parent.element.querySelector('.' + literals.gridHeader)
                .querySelector(literals.colGroup + ':not(.e-masked-colgroup)').cloneNode(true);
        };
        ContentRender.prototype.initializeContentDrop = function () {
            var gObj = this.parent;
            this.droppable = new ej2_base_1.Droppable(gObj.element, {
                accept: '.e-dragclone',
                drop: this.drop
            });
        };
        ContentRender.prototype.droppableDestroy = function () {
            if (this.droppable && !this.droppable.isDestroyed) {
                this.droppable.destroy();
            }
        };
        ContentRender.prototype.canSkip = function (column, row, index) {
            return ej2_base_2.isNullOrUndefined(row) ||
                ej2_base_2.isNullOrUndefined(column.visible) ||
                row.cells[parseInt(index.toString(), 10)].visible === column.visible;
        };
        ContentRender.prototype.getModelGenerator = function () {
            return this.generator = this.parent.allowGrouping ? new group_model_generator_1.GroupModelGenerator(this.parent) : new row_model_generator_1.RowModelGenerator(this.parent);
        };
        ContentRender.prototype.renderEmpty = function (tbody) {
            this.getTable().appendChild(tbody);
            if (this.parent.frozenRows) {
                this.parent.getHeaderContent().querySelector(literals.tbody).innerHTML = '';
            }
        };
        ContentRender.prototype.setSelection = function (uid, set, clearAll) {
            this.parent.notify(events.setFreezeSelection, { uid: uid, set: set, clearAll: clearAll });
            var row = this.getRows().filter(function (row) { return clearAll || uid === row.uid; });
            for (var j = 0; j < row.length; j++) {
                row[parseInt(j.toString(), 10)].isSelected = set;
                var cells = row[parseInt(j.toString(), 10)].cells;
                for (var k = 0; k < cells.length; k++) {
                    cells[parseInt(k.toString(), 10)].isSelected = set;
                }
            }
        };
        ContentRender.prototype.getRowByIndex = function (index) {
            index = this.getInfiniteRowIndex(index);
            return !ej2_base_2.isNullOrUndefined(index) ? this.parent.getDataRows()[parseInt(index.toString(), 10)] : undefined;
        };
        ContentRender.prototype.getInfiniteRowIndex = function (index) {
            if (this.parent.infiniteScrollSettings.enableCache && !ej2_base_2.isNullOrUndefined(index)) {
                var fRows = this.parent.frozenRows;
                var idx = fRows > index ? 0 : fRows;
                var firstRowIndex = parseInt(this.parent.getRows()[parseInt(idx.toString(), 10)]
                    .getAttribute(literals.dataRowIndex), 10);
                index = fRows > index ? index : (index - firstRowIndex) + fRows;
            }
            return index;
        };
        ContentRender.prototype.getVirtualRowIndex = function (index) {
            return index;
        };
        ContentRender.prototype.enableAfterRender = function (e) {
            if (e.module === 'group' && e.enable) {
                this.generator = this.getModelGenerator();
            }
        };
        ContentRender.prototype.setRowObjects = function (rows) {
            this.rows = rows;
        };
        ContentRender.prototype.immutableModeRendering = function (args) {
            var _this = this;
            if (args === void 0) { args = {}; }
            var gObj = this.parent;
            gObj.hideSpinner();
            var key = gObj.getPrimaryKeyFieldNames()[0];
            var oldKeys = {};
            var newKeys = {};
            var newRowObjs = [];
            var oldIndexes = {};
            var oldRowObjs = gObj.getRowsObject().slice();
            var batchChangeKeys = this.getBatchEditedRecords(key, oldRowObjs);
            var newIndexes = {};
            var hasBatch = Object.keys(batchChangeKeys).length !== 0;
            if (gObj.getContent().querySelector('.e-emptyrow') || args.requestType === 'reorder'
                || this.parent.groupSettings.columns.length) {
                this.refreshContentRows(args);
            }
            else {
                Iif (gObj.currentViewData.length === 0) {
                    return;
                }
                var oldRowElements = {};
                var tbody = gObj.createElement(literals.tbody, { attrs: { role: 'rowgroup' } });
                var dataSource = gObj.currentViewData;
                var trs = [].slice.call(this.getTable().querySelector(literals.tbody).children);
                if (this.prevCurrentView.length) {
                    var prevLen = this.prevCurrentView.length;
                    var currentLen = dataSource.length;
                    Eif (prevLen === currentLen) {
                        for (var i = 0; i < currentLen; i++) {
                            Iif (this.parent.editSettings.mode === 'Batch'
                                && trs[parseInt(i.toString(), 10)].classList.contains('e-insertedrow')) {
                                trs.splice(i, 1);
                                --i;
                                continue;
                            }
                            newKeys[dataSource[parseInt(i.toString(), 10)]["" + key]] = oldKeys[this.prevCurrentView[parseInt(i.toString(), 10)]["" + key]] = i;
                            newIndexes[parseInt(i.toString(), 10)] = dataSource[parseInt(i.toString(), 10)]["" + key];
                            oldRowElements[oldRowObjs[parseInt(i.toString(), 10)].uid] = trs[parseInt(i.toString(), 10)];
                            oldIndexes[parseInt(i.toString(), 10)] = this.prevCurrentView[parseInt(i.toString(), 10)]["" + key];
                        }
                    }
                    else {
                        for (var i = 0; i < currentLen; i++) {
                            newKeys[dataSource[parseInt(i.toString(), 10)]["" + key]] = i;
                            newIndexes[parseInt(i.toString(), 10)] = dataSource[parseInt(i.toString(), 10)]["" + key];
                        }
                        for (var i = 0; i < prevLen; i++) {
                            if (this.parent.editSettings.mode === 'Batch'
                                && trs[parseInt(i.toString(), 10)].classList.contains('e-insertedrow')) {
                                trs.splice(i, 1);
                                --i;
                                continue;
                            }
                            oldRowElements[oldRowObjs[parseInt(i.toString(), 10)].uid] = trs[parseInt(i.toString(), 10)];
                            oldKeys[this.prevCurrentView[parseInt(i.toString(), 10)]["" + key]] = i;
                            oldIndexes[parseInt(i.toString(), 10)] = this.prevCurrentView[parseInt(i.toString(), 10)]["" + key];
                        }
                    }
                }
                for (var i = 0; i < dataSource.length; i++) {
                    var oldIndex = oldKeys[dataSource[parseInt(i.toString(), 10)]["" + key]];
                    if (!ej2_base_2.isNullOrUndefined(oldIndex)) {
                        var isEqual = false;
                        Eif (this.parent.enableDeepCompare) {
                            isEqual = this.objectEqualityChecker(this.prevCurrentView[parseInt(oldIndex.toString(), 10)], dataSource[parseInt(i.toString(), 10)]);
                        }
                        var tr = oldRowElements[oldRowObjs[parseInt(oldIndex.toString(), 10)]
                            .uid];
                        newRowObjs.push(oldRowObjs[parseInt(oldIndex.toString(), 10)]);
                        Eif (this.rowElements[parseInt(oldIndex.toString(), 10)] && this.rowElements[parseInt(oldIndex.toString(), 10)].getAttribute('data-uid') === newRowObjs[parseInt(i.toString(), 10)].uid
                            && ((hasBatch && ej2_base_2.isNullOrUndefined(batchChangeKeys[newIndexes[parseInt(i.toString(), 10)]]))
                                || (!hasBatch && (isEqual
                                    || this.prevCurrentView[parseInt(oldIndex.toString(), 10)] === dataSource[parseInt(i.toString(), 10)])))) {
                            if (oldIndex !== i) {
                                this.refreshImmutableContent(i, tr, newRowObjs[parseInt(i.toString(), 10)]);
                            }
                            tbody.appendChild(tr);
                            continue;
                        }
                        if ((hasBatch && !ej2_base_2.isNullOrUndefined(batchChangeKeys[newIndexes[parseInt(i.toString(), 10)]]))
                            || (!this.parent.enableDeepCompare
                                && dataSource[parseInt(i.toString(), 10)] !== this.prevCurrentView[parseInt(oldIndex.toString(), 10)])
                            || (this.parent.enableDeepCompare && !isEqual)) {
                            oldRowObjs[parseInt(oldIndex.toString(), 10)].setRowValue(dataSource[parseInt(i.toString(), 10)]);
                        }
                        tbody.appendChild(tr);
                        this.refreshImmutableContent(i, tr, newRowObjs[parseInt(i.toString(), 10)]);
                    }
                    else {
                        var row = new row_renderer_1.RowRenderer(this.serviceLocator, null, gObj);
                        var args_1 = { startIndex: i };
                        var modelData = this.generator.generateRows([dataSource[parseInt(i.toString(), 10)]], args_1);
                        newRowObjs.push(modelData[0]);
                        var tr = row.render(modelData[0], gObj.getColumns());
                        tbody.appendChild(tr);
                        this.refreshImmutableContent(i, tr, newRowObjs[parseInt(i.toString(), 10)]);
                    }
                }
                this.rows = newRowObjs;
                this.rowElements = [].slice.call(tbody.children);
                ej2_base_3.remove(this.getTable().querySelector(literals.tbody));
                this.getTable().appendChild(tbody);
                this.parent.trigger(events.dataBound, {}, function () {
                    Iif (_this.parent.allowTextWrap) {
                        _this.parent.notify(events.freezeRender, { case: 'textwrap' });
                    }
                });
                Eif (args) {
                    var action = (args.requestType || '').toLowerCase() + '-complete';
                    this.parent.notify(action, args);
                }
            }
        };
        ContentRender.prototype.objectEqualityChecker = function (old, next) {
            var keys = Object.keys(old);
            var isEqual = true;
            for (var i = 0; i < keys.length; i++) {
                if (old[keys[parseInt(i.toString(), 10)]] !== next[keys[parseInt(i.toString(), 10)]]) {
                    var isDate = old[keys[parseInt(i.toString(), 10)]] instanceof Date
                        && next[keys[parseInt(i.toString(), 10)]] instanceof Date;
                    Iif (!isDate || (old[keys[parseInt(i.toString(), 10)]]
                        .getTime() !== next[keys[parseInt(i.toString(), 10)]].getTime())) {
                        isEqual = false;
                        break;
                    }
                }
            }
            return isEqual;
        };
        ContentRender.prototype.getBatchEditedRecords = function (primaryKey, rows) {
            var keys = {};
            var changes = this.parent.getBatchChanges();
            var changedRecords = [];
            var addedRecords = [];
            Iif (Object.keys(changes).length) {
                changedRecords = changes.changedRecords;
                addedRecords = changes.addedRecords;
            }
            var args = { cancel: false };
            this.parent.notify(events.immutableBatchCancel, { rows: rows, args: args });
            Iif (addedRecords.length) {
                if (this.parent.editSettings.newRowPosition === 'Bottom') {
                    rows.splice(rows.length - 1, addedRecords.length);
                }
                else {
                    if (!args.cancel) {
                        rows.splice(0, addedRecords.length);
                    }
                }
            }
            for (var i = 0; i < changedRecords.length; i++) {
                keys[changedRecords[parseInt(i.toString(), 10)]["" + primaryKey]] = i;
            }
            return keys;
        };
        ContentRender.prototype.refreshImmutableContent = function (index, tr, row) {
            row.isAltRow = this.parent.enableAltRow ? index % 2 !== 0 : false;
            if (row.isAltRow) {
                tr.classList.add('e-altrow');
            }
            else {
                tr.classList.remove('e-altrow');
            }
            row.index = index;
            row.edit = undefined;
            row.isDirty = false;
            tr.setAttribute(literals.dataRowIndex, index.toString());
            tr.setAttribute(literals.ariaRowIndex, (index + 1).toString());
            this.updateCellIndex(tr, index);
        };
        ContentRender.prototype.updateCellIndex = function (rowEle, index) {
            for (var i = 0; i < rowEle.cells.length; i++) {
                rowEle.cells[parseInt(i.toString(), 10)].setAttribute('index', index.toString());
            }
        };
        return ContentRender;
    }());
    exports.ContentRender = ContentRender;
});