【问题标题】:nativescript 'this' inside tkListViewHeader (RadListView header directive)tkListViewHeader 内的 nativescript 'this'(RadListView 标头指令)
【发布时间】:2017-05-02 09:04:11
【问题描述】:

我在 nativescript 中使用 Teleriks RadListView 的 TKListViewHeaderDirective,如下所示:

<GridLayout columns="*" rows="*" tkToggleNavButton>
    <RadListView *ngIf="!loading" row="3" col="0" [items]="nodes" ...>
        <ng-template tkListItemTemplate let-node="item">
            <!-- list item -->
        </ng-template>
        <ng-template tkListViewHeader>
            <GridLayout columns="*" rows="auto, auto, auto">
                <GridLayout row="0" col="0" columns="40,*,40">
                    <Button class="fa action-item" row="0" col="0" [text]="'fa-sort-amount-asc' | fonticon" ios.position="right" android="actionBar" style="background-color:#c9c9ce;;"></Button>
                    <SearchBar row="0" col="1" #searchInput hint="Search" (submit)="search(searchInput.text)" (clear)="search('')" (textChange)="search(searchInput.text)"></SearchBar>
                    <Button class="fa action-item" row="0" col="2" [text]="'fa-th' | fonticon" ios.position="right" android="actionBar" style="background-color:#c9c9ce;"></Button>
                </GridLayout>
                <StackLayout row="1" col="0">
                    <Label text="Hello world"></Label>
                    <Label [text]="currentNode.name"></Label>
                    <Label [text]="nodes?.length ? nodes.length : 0"></Label>
                </StackLayout>
                <StackLayout row="2" col="0" *ngIf="!nodes?.length" class="list-group">
                    <!-- some contents -->
                </StackLayout>
                <StackLayout row="3" col="0" *ngIf="currentNode?.name !== '/'" class="list-group">
                    <!-- some contents -->
                </StackLayout>
            </GridLayout>
        </ng-template>
    </RadListView>
</GridLayout>

这里似乎有两个问题:

  1. this 似乎在这里丢失(*ngIf 应该在特定情况下显示 StackLayouts 之一,但不会
  2. 列表标题内的 GridLayout(如果我将其更改为 StackLayout 则没有任何效果)仅显示一个子元素

根据文档:http://docs.telerik.com/devtools/nativescript-ui/Controls/Angular/ListView/header-footer

【问题讨论】:

    标签: nativescript angular2-nativescript nativescript-telerik-ui


    【解决方案1】:

    github上有一个关于这个的问题:https://github.com/telerik/nativescript-ui-feedback/issues/207

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多