• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IgniteUI / igniteui-angular-wrappers / 4427504397

pending completion
4427504397

push

github

GitHub
Update README.md

281 of 305 branches covered (92.13%)

Branch coverage included in aggregate %.

668 of 713 relevant lines covered (93.69%)

219.79 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

74.19
/projects/igniteui-angular-wrappers/src/lib/ighierarchicalgrid/ighierarchicalgrid.component.ts
1
import {
2
  Component,
3
  IterableDiffers,
4
  KeyValueDiffers,
5
  ChangeDetectorRef,
6
  ElementRef,
7
  ChangeDetectionStrategy,
8
  Renderer2,
9
  Input
10
} from '@angular/core';
11
import { IgGridBase } from '../iggrid/iggridbase';
12

13
declare var jQuery: any;
14

15
@Component({
16
    changeDetection: ChangeDetectionStrategy.OnPush,
17
    selector: 'ig-hierarchical-grid',
18
    template: '<ng-content></ng-content>',
19
    inputs: ['widgetId', 'options', 'changeDetectionInterval', 'disabled', 'create', 'initialDataBindDepth', 'initialExpandDepth', 'odata', 'rest', 'maxDataBindDepth', 'defaultChildrenDataProperty', 'autoGenerateLayouts', 'expandCollapseAnimations', 'expandColWidth', 'pathSeparator', 'animationDuration', 'expandTooltip', 'collapseTooltip', 'columnLayouts', 'width', 'height', 'autoAdjustHeight', 'avgRowHeight', 'avgColumnWidth', 'defaultColumnWidth', 'autoGenerateColumns', 'virtualization', 'virtualizationMode', 'requiresDataBinding', 'rowVirtualization', 'columnVirtualization', 'virtualizationMouseWheelStep', 'adjustVirtualHeights', 'templatingEngine', 'columns', 'dataSource', 'dataSourceUrl', 'dataSourceType', 'responseDataKey', 'responseTotalRecCountKey', 'requestType', 'responseContentType', 'showHeader', 'showFooter', 'fixedHeaders', 'fixedFooters', 'caption', 'features', 'tabIndex', 'localSchemaTransform', 'primaryKey', 'serializeTransactionLog', 'autoCommit', 'aggregateTransactions', 'autoFormat', 'renderCheckboxes', 'updateUrl', 'restSettings', 'alternateRowStyles', 'autofitLastColumn', 'enableHoverStyles', 'enableUTCDates', 'mergeUnboundColumns', 'jsonpRequest', 'enableResizeContainerCheck', 'featureChooserIconDisplay', 'scrollSettings'],
20
    outputs: ['rowExpanding', 'rowExpanded', 'rowCollapsing', 'rowCollapsed', 'childrenPopulating', 'childrenPopulated',
21
    'childGridRendered', 'childGridCreating', 'childGridCreated', 'cellClick', 'cellRightClick', 'dataBinding', 'dataBound', 'rendering', 'rendered', 'dataRendering', 'dataRendered', 'headerRendering', 'headerRendered', 'footerRendering', 'footerRendered', 'headerCellRendered', 'rowsRendering', 'rowsRendered', 'schemaGenerated', 'columnsCollectionModified', 'requestError', 'created', 'destroyed']
22
})
23
export class IgHierarchicalGridComponent extends IgGridBase<IgHierarchicalGrid> {
1✔
24
    @Input()
25
    public childrenDataProperty: string;
26

27
    constructor(el: ElementRef, renderer: Renderer2, differs: IterableDiffers, kvalDiffers: KeyValueDiffers, cdr: ChangeDetectorRef) {
28
      super(el, renderer, differs, kvalDiffers, cdr);
13✔
29
    }
30

31
    deleteRow(id) {
32
        const element = jQuery(this._el);
3✔
33
        const tr = element.find('tr[data-id=\'' + id + '\']');
3✔
34
        const childContainer = tr.next('tr[data-container]');
3✔
35

36
        if (tr.length > 0) {
3✔
37
            tr.remove();
1✔
38
            childContainer.remove();
1✔
39
            element.data('igGrid').dataSource.deleteRow(id, true);
1✔
40
            element.data('igGrid').dataSource._removeTransactionsByRecordId(id);
1✔
41
        }
42
    }
43
    updateRow(rec, currValue, key) {
44
        const element = jQuery(this._el);
1✔
45
        const childrenDataProperty = this.childrenDataProperty || this.options.childrenDataProperty;
1✔
46

47
        const childGrids = element.data(this._widgetName).allChildrenWidgets().filter(widget => {
1✔
48
            const parentRow = widget.closest('tr[data-container]').prev();
×
49
            const parentGridPK = parentRow.closest('.ui-iggrid-table').data('igGrid').options.primaryKey;
×
50
            return (childrenDataProperty === key ||
×
51
                parentRow.next('[data-container]').find('table[role=\'grid\']').attr('id').contains('_' + key + '_'))
52
                && parentRow.attr('data-id') === rec[parentGridPK];
53
        });
54
        if (childGrids.length > 0) {
1!
55
          childGrids.each((index, grid) => grid.dataBind());
×
56
        } else {
57
            super.updateRow(rec, currValue, key);
1✔
58
        }
59
    }
60
    public markForCheck() {
61
        super.markForCheck();
1✔
62
        const element = jQuery(this._el);
1✔
63
        const childGrids = element.data(this._widgetName).allChildrenWidgets().filter(widget => true);
1✔
64
        childGrids.each((index, grid) => grid.dataBind());
1✔
65
    }
66
    /**
67
     * Data binds the hierarchical grid. No child grids will be created or rendered by default, unless there is initialExpandDepth >= 0 set.
68
     */
69
    /* istanbul ignore next */
70
    public dataBind(): void { return; }
71

72
    /**
73
     * Returns the element of the root grid (igGrid)
74
     */
75
    /* istanbul ignore next */
76
    public root(): object { return; }
77

78
    /**
79
     * Returns the widget object of the root grid (igGrid)
80
     */
81
    /* istanbul ignore next */
82
    public rootWidget(): object { return; }
83

84
    /**
85
     * Returns a flat list of all child grid elements (recursive)
86
     */
87
    /* istanbul ignore next */
88
    public allChildren(): object { return; }
89

90
    /**
91
     * Expands or collapses (toggles) a parent row
92
     * Note: This method is asynchronous which means that it returns immediately and any subsequent code will execute in parallel.
93
     * This may lead to runtime errors. To avoid them put the subsequent code in the callback parameter provided by the method.
94
     *
95
     * @param element     accepts a dom element, or a jquery wrapped dom element that should be a TR and should specify a parent row
96
     * @param callback     Specifies a custom function to be called when parent row is toggled(optional).
97
     * Takes 2 arguments - first is hierarchical grid object, second is the row element that was toggled
98
     */
99
    /* istanbul ignore next */
100
    public toggle(element: Element, callback?: () => void): void { return; }
101

102
    /**
103
     * Expands (toggles) a parent row
104
     * Note: This method is asynchronous which means that it returns immediately and any subsequent code will execute in parallel.
105
     * This may lead to runtime errors. To avoid them put the subsequent code in the callback parameter provided by the method.
106
     *
107
     * @param id     accepts a dom element, or a jquery wrapped dom element that should be a TR and should specify a parent row
108
     * @param callback     Specifies a custom function to be called when parent row is expanded(optional).
109
     * Takes 2 arguments first is hierarchical grid object, second is the row element that was expanded
110
     */
111
    /* istanbul ignore next */
112
    public expand(id: Element, callback?: () => void): void { return; }
113

114
    /**
115
     * Collapses a parent row
116
     * Note: This method is asynchronous which means that it returns immediately and any subsequent code will execute in parallel.
117
     * This may lead to runtime errors. To avoid them put the subsequent code in the callback parameter provided by the method.
118
     *
119
     * @param id accepts a dom element, or a jquery wrapped dom element that should be a TR and should specify a parent row
120
     * @param callback Specifies a custom function to be called when parent row is expanded(optional).
121
     * Takes 2 arguments - first is hierarchical grid object, second is the row element that was collapsed
122
     */
123
    /* istanbul ignore next */
124
    public collapse(id: Element, callback?: () => void): void { return; }
125

126
    /**
127
     * Checks if a parent row is currently collapsed
128
     *
129
     * @param element     accepts a dom element, or a jquery wrapped dom element that should be a TR and should specify a parent row
130
     */
131
    /* istanbul ignore next */
132
    public collapsed(element: Element): boolean { return; }
133

134
    /**
135
     * Checks if a parent row is populated with data
136
     *
137
     * @param element     accepts a dom element, or a jquery wrapped dom element that should be a TR and should specify a parent row
138
     */
139
    /* istanbul ignore next */
140
    public populated(element: Element): boolean { return; }
141

142
    /**
143
     * Commits pending transactions to the client data source for main and all child grids.
144
     */
145
    /* istanbul ignore next */
146
    public commit(): void { return; }
147

148
    /**
149
     * Clears the transaction log (delegates to igDataSource). Note that this does not update the UI.
150
     * In case the UI must be updated, set the second parameter "updateUI" to true, which will trigger a call to dataBind()
151
     * to re-render the contents.
152
     *
153
     * @param rebind     Whether to perform a rebind.
154
     */
155
    /* istanbul ignore next */
156
    public rollback(rebind?: boolean): void { return; }
157

158
    /**
159
     * Posts to the settings.updateUrl using $.ajax, by serializing the changes as url params
160
     *
161
     * @param success    Specifies a custom function to be called when AJAX request to the updateUrl option succeeds(optional)
162
     * @param error    Specifies a custom function to be called when AJAX request to the updateUrl option fails(optional)
163
     */
164
    /* istanbul ignore next */
165
    public saveChanges(success: () => void, error: () => void): void { return; }
166

167
    /**
168
     * Destroys the hierarchical grid by recursively destroying all child grids
169
     */
170
    /* istanbul ignore next */
171
    public destroy(): void { return; }
172
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc