Skip to content

Commit

Permalink
Fixed #939 - Optional chaining not working for TreeTable in version 3…
Browse files Browse the repository at this point in the history
….2.1
  • Loading branch information
cagataycivici committed Feb 4, 2021
1 parent 5522885 commit 5c0e0bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/components/treetable/TreeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
<th v-for="(col,i) of columns" :key="columnProp(col, 'columnKey')||columnProp(col, 'field')||i" :style="columnProp(col, 'headerStyle')" :class="getColumnHeaderClass(col)" @click="onColumnHeaderClick($event, col)"
:tabindex="columnProp(col, 'sortable') ? '0' : null" :aria-sort="getAriaSort(col)" @keydown="onColumnKeyDown($event, col)">
<span class="p-column-resizer" @mousedown="onColumnResizeStart" v-if="resizableColumns"></span>
<component :is="col.children?.header" :column="col" />
<component :is="col.children.header" :column="col" v-if="col.children && col.children.header" />
<span class="p-column-title" v-if="columnProp(col, 'header')">{{columnProp(col, 'header')}}</span>
<span v-if="columnProp(col, 'sortable')" :class="getSortableColumnIcon(col)"></span>
<span v-if="isMultiSorted(col)" class="p-sortable-column-badge">{{getMultiSortMetaIndex(col) + 1}}</span>
</th>
</tr>
<tr v-if="hasColumnFilter()">
<th v-for="(col,i) of columns" :key="columnProp(col, 'columnKey')||columnProp(col, 'field')||i" :class="getFilterColumnHeaderClass(col)" :style="columnProp(col, 'filterHeaderStyle')">
<component :is="col.children?.filter" :column="col" v-if="col.children?.filter"/>
<component :is="col.children.filter" :column="col" v-if="col.children && col.children.filter"/>
</th>
</tr>
</thead>
<tfoot class="p-treetable-tfoot" v-if="hasFooter">
<tr>
<td v-for="(col,i) of columns" :key="columnProp(col, 'columnKey')||columnProp(col, 'field')||i" :style="columnProp(col, 'footerStyle')" :class="columnProp(col, 'footerClass')">
<component :is="col.children?.footer" :column="col" />
<component :is="col.children.footer" :column="col" v-if="col.children && col.children.footer" />
{{columnProp(col, 'footer')}}
</td>
</tr>
Expand Down Expand Up @@ -773,7 +773,7 @@ export default {
hasColumnFilter() {
if (this.columns) {
for (let col of this.columns) {
if (col.children?.filter) {
if (col.children && col.children.filter) {
return true;
}
}
Expand Down Expand Up @@ -858,7 +858,7 @@ export default {
let hasFooter = false;
for (let col of this.columns) {
if (this.columnProp(col, 'footer')|| col.children?.footer) {
if (this.columnProp(col, 'footer')|| (col.children && col.children.footer)) {
hasFooter = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/treetable/TreeTableRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<span :class="checkboxIcon"></span>
</div>
</div>
<component :is="col.children?.body" :node="node" :column="col" v-if="col.children?.body" />
<component :is="col.children.body" :node="node" :column="col" v-if="col.children && col.children.body" />
<template v-else><span>{{resolveFieldData(node.data, columnProp(col, 'field'))}}</span></template>
</td>
</tr>
Expand Down

0 comments on commit 5c0e0bf

Please sign in to comment.