Skip to content

Commit 517ce9d

Browse files
committed
Documenting grid feature tags
Fixes #174
1 parent a0343f5 commit 517ce9d

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

README.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,51 @@ when there are overlapping properties. Also changing top-level attribute will ap
123123
}
124124
}
125125

126-
### Aply new set of Control Options
126+
### Other custom tags
127+
128+
There are two custom tags `<column>` and `<features>` that are used in igGrid/igTreeGrid/igHierarchicalGrid to configure the `columns` and `features` options accordingly.
129+
130+
#### Example:
131+
132+
<ig-grid [widgetId]='id'>
133+
<column [key]="'ProductID'" [headerText]="'Product ID'" [width]="'165px'" [dataType]="'number'"></column>
134+
<column [key]="'ProductName'" [headerText]="'Product Name'" [width]="'250px'" [dataType]="'string'"></column>
135+
<column [key]="'QuantityPerUnit'" [headerText]="'Quantity per unit'" [width]="'250px'" [dataType]="'string'"></column>
136+
<column [key]="'UnitPrice'" [headerText]="'Unit Price'" [width]="'100px'" [dataType]="'number'"></column>
137+
<features>
138+
<paging [pageSize]="currPageSize"></paging>
139+
<filtering></filtering>
140+
<selection></selection>
141+
<group-by></group-by>
142+
</features>
143+
</ig-grid>
144+
145+
Each of the grids features is also represented by a custom tag.
146+
147+
#### Examples:
148+
149+
| Feature Name | Tag |
150+
|--------------------|---------------------------|
151+
| ColumnMoving | `<column-moving>` |
152+
| Filtering | `<filtering>` |
153+
| GroupBy | `<group-by>` |
154+
| Hiding | `<hiding>` |
155+
| CellMerging | `<cell-merging>` |
156+
| AppendRowsOnDemand | `<append-rows-on-demand>` |
157+
| MultiColumnHeaders | `<multi-column-headers>` |
158+
| Paging | `<paging>` |
159+
| Responsive | `<responsive>` |
160+
| Resizing | `<resizing>` |
161+
| RowSelectors | `<row-selectors>` |
162+
| Selection | `<selection>` |
163+
| Sorting | `<sorting>` |
164+
| Summaries | `<summaries>` |
165+
| ColumnFixing | `<column-fixing>` |
166+
| Tooltips | `<tooltips>` |
167+
| Updating | `<updating>` |
168+
169+
170+
### Apply new set of Control Options
127171

128172
In order to change the more options at once (or recreate the component with another set of options), the new configuration can be applied to the `options` property.
129173

src/igniteui.angular2.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ export class Feature<Model> {
102102

103103
constructor(el: ElementRef) {
104104
this._el = el;
105-
let nodeName = el.nativeElement.nodeName.toLowerCase();
106-
this.name = nodeName.charAt(0).toUpperCase() + nodeName.slice(1);
105+
this.name = this.normalizeName(el.nativeElement.nodeName.toLowerCase());
107106
this.featureName = "igGrid" + this.name;
108107
for (var propt in jQuery.ui["igGrid" + this.name].prototype.events) {
109108
this[propt] = new EventEmitter();
@@ -171,6 +170,14 @@ export class Feature<Model> {
171170
return jQuery.proxy(feature[name], feature);
172171
}
173172
}
173+
174+
normalizeName(str) {
175+
//convert hyphen to camelCase
176+
let name = str.replace(/-([a-z])/g, function (group) {
177+
return group[1].toUpperCase();
178+
})
179+
return name.charAt(0).toUpperCase() + name.slice(1);
180+
}
174181
}
175182

176183
@Directive({
@@ -424,7 +431,7 @@ export class IgGridUpdatingFeature extends Feature<IgGridUpdating> {
424431
}
425432

426433
@Directive({
427-
selector: 'groupBy',
434+
selector: 'group-by',
428435
inputs: ["disabled","create","groupByAreaVisibility","initialExpand","emptyGroupByAreaContent","emptyGroupByAreaContentSelectColumns","expansionIndicatorVisibility","groupByLabelWidth","labelDragHelperOpacity","indentation","defaultSortingDirection","groupedColumns","resultResponseKey","groupedRowTextTemplate","type","groupByUrlKey","groupByUrlKeyAscValue","groupByUrlKeyDescValue","summarySettings","columnSettings","expandTooltip","collapseTooltip","removeButtonTooltip","modalDialogGroupByOnClick","modalDialogGroupByButtonText","modalDialogCaptionButtonDesc","modalDialogCaptionButtonAsc","modalDialogCaptionButtonUngroup","modalDialogCaptionText","modalDialogDropDownLabel","modalDialogRootLevelHierarchicalGrid","modalDialogDropDownButtonCaption","modalDialogClearAllButtonLabel","emptyGroupByAreaContentSelectColumnsCaption","modalDialogDropDownWidth","modalDialogDropDownAreaWidth","modalDialogAnimationDuration","modalDialogWidth","modalDialogHeight","modalDialogButtonApplyText","modalDialogButtonCancelText","useGridColumnFormatter","persist","groupByDialogContainment","dialogWidget","inherit"],
429436
outputs: ["groupedColumnsChanging","groupedColumnsChanged","modalDialogMoving","modalDialogClosing","modalDialogClosed","modalDialogOpening","modalDialogOpened","modalDialogContentsRendering","modalDialogContentsRendered","modalDialogButtonApplyClick","modalDialogButtonResetClick","modalDialogGroupingColumn","modalDialogGroupColumn","modalDialogUngroupingColumn","modalDialogUngroupColumn","modalDialogSortGroupedColumn"]
430437
})
@@ -523,7 +530,7 @@ export class IgGridGroupByFeature extends Feature<IgGridGroupBy> {
523530
}
524531

525532
@Directive({
526-
selector: 'columnMoving',
533+
selector: 'column-moving',
527534
inputs: ["disabled","create","columnSettings","mode","moveType","addMovingDropdown","movingDialogWidth","movingDialogHeight","movingDialogAnimationDuration","movingAcceptanceTolerance","movingScrollTolerance","scrollSpeedMultiplier","scrollDelta","hideHeaderContentsDuringDrag","dragHelperOpacity","movingDialogCaptionButtonDesc","movingDialogCaptionButtonAsc","movingDialogCaptionText","movingDialogDisplayText","movingDialogDropTooltipText","movingDialogDropTooltipMarkup","dropDownMoveLeftText","dropDownMoveRightText","dropDownMoveFirstText","dropDownMoveLastText","movingToolTipMove","featureChooserSubmenuText","columnMovingDialogContainment","dialogWidget","inherit"],
528535
outputs: ["columnDragStart","columnDragEnd","columnDragCanceled","columnMoving","columnMoved","movingDialogOpening","movingDialogOpened","movingDialogDragged","movingDialogClosing","movingDialogClosed","movingDialogContentsRendering","movingDialogContentsRendered","movingDialogMoveUpButtonPressed","movingDialogMoveDownButtonPressed","movingDialogDragColumnMoving","movingDialogDragColumnMoved"]
529536
})

0 commit comments

Comments
 (0)