Coder Social home page Coder Social logo

表格部分 about ng-devui HOT 8 CLOSED

devcloudfe avatar devcloudfe commented on May 18, 2024
表格部分

from ng-devui.

Comments (8)

qull avatar qull commented on May 18, 2024

1、问题将在下次版本修复
2、目前设计风格如此,考虑通过开放自定义td样式来实现

from ng-devui.

qiuhaohui163 avatar qiuhaohui163 commented on May 18, 2024

1、问题将在下次版本修复
2、目前设计风格如此,考虑通过开放自定义td样式来实现

thank 另外建议可否增加列宽调整和列拖拽后的保存功能

from ng-devui.

qull avatar qull commented on May 18, 2024

1、问题将在下次版本修复
2、目前设计风格如此,考虑通过开放自定义td样式来实现

thank 另外建议可否增加列宽调整和列拖拽后的保存功能

这些都有事件,通过事件回调自己保存

from ng-devui.

qiuhaohui163 avatar qiuhaohui163 commented on May 18, 2024

child: my-component

<...>
  <d-data-table>
    <!-- 固定列-->
    <d-column field="$index" header="index" width="60px"></d-column>
    <!-- 自定义列 由上级传入-->
    <ng-content ngProjectAs="d-column" select="d-column"></ng-content>
  </d-data-table>
</...>

father

<my-component>
  <d-column field="test1" header="test1" width="60px"></d-column>
  <d-column field="test2" header="test2" width="60px">
     <!--    自定义cell-->
  </d-column>
</my-component>

请教一下大佬, 为什么按以上的方法只能显示固定列.
如果改为

    <ng-container ngProjectAs="d-column"  *ngTemplateOutlet="tmp"> </ng-container>
    <ng-template #tmp>
      <d-column field="key" header="key" width="160px"></d-column>
    </ng-template>

方式, 则tmp必须在d-data-table标签之下才能显示, 标签外或者由上级传入无法显示
可否解释一下是哪里用错了,该如何解决, 不胜感谢

from ng-devui.

qull avatar qull commented on May 18, 2024

child: my-component

<...>
  <d-data-table>
    <!-- 固定列-->
    <d-column field="$index" header="index" width="60px"></d-column>
    <!-- 自定义列 由上级传入-->
    <ng-content ngProjectAs="d-column" select="d-column"></ng-content>
  </d-data-table>
</...>

father

<my-component>
  <d-column field="test1" header="test1" width="60px"></d-column>
  <d-column field="test2" header="test2" width="60px">
     <!--    自定义cell-->
  </d-column>
</my-component>

请教一下大佬, 为什么按以上的方法只能显示固定列.
如果改为

    <ng-container ngProjectAs="d-column"  *ngTemplateOutlet="tmp"> </ng-container>
    <ng-template #tmp>
      <d-column field="key" header="key" width="160px"></d-column>
    </ng-template>

方式, 则tmp必须在d-data-table标签之下才能显示, 标签外或者由上级传入无法显示
可否解释一下是哪里用错了,该如何解决, 不胜感谢

你的需求是自定义cell吗?参考API中自定义cell的部分:

<d-column field="gender" header="Gender" [sortable]="true" [width]="'100px'">
  <d-cell>
    <ng-template let-cellItem="cellItem">
      <span dTooltip [content]='cellItem' [position]="'bottom'">
        {{cellItem.toUpperCase()}}
      </span>
    </ng-template>
  </d-cell>
</d-column>

from ng-devui.

qiuhaohui163 avatar qiuhaohui163 commented on May 18, 2024

child: my-component

<...>
  <d-data-table>
    <!-- 固定列-->
    <d-column field="$index" header="index" width="60px"></d-column>
    <!-- 自定义列 由上级传入-->
    <ng-content ngProjectAs="d-column" select="d-column"></ng-content>
  </d-data-table>
</...>

father

<my-component>
  <d-column field="test1" header="test1" width="60px"></d-column>
  <d-column field="test2" header="test2" width="60px">
     <!--    自定义cell-->
  </d-column>
</my-component>

请教一下大佬, 为什么按以上的方法只能显示固定列.
如果改为

    <ng-container ngProjectAs="d-column"  *ngTemplateOutlet="tmp"> </ng-container>
    <ng-template #tmp>
      <d-column field="key" header="key" width="160px"></d-column>
    </ng-template>

方式, 则tmp必须在d-data-table标签之下才能显示, 标签外或者由上级传入无法显示
可否解释一下是哪里用错了,该如何解决, 不胜感谢

你的需求是自定义cell吗?参考API中自定义cell的部分:

<d-column field="gender" header="Gender" [sortable]="true" [width]="'100px'">
  <d-cell>
    <ng-template let-cellItem="cellItem">
      <span dTooltip [content]='cellItem' [position]="'bottom'">
        {{cellItem.toUpperCase()}}
      </span>
    </ng-template>
  </d-cell>
</d-column>

不是, 是自定义列或者说动态列. 如果按api中的在ts中设置

 dataTableOptions = {
    columns: [
        {
            field: 'firstName',
            header: 'First Name',
            fieldType: 'text'
        },
        {
            field: 'test1',
            header: 'test1',
            fieldType: 'text'
        },
        {
            field: 'test2',
            header: 'test2',
            fieldType: 'text'
        }
    ]
};

这样的话,列是可以根据dataTableOptions 改变而动态,
但是此时test1或者test2 列想动态单元格内容和样式 就无法办到.
因为不确定这张表需要的是test1或test2字段,或者甚至是test3, test4 字段
这些数据会在父级传入时得出.

现在想完成的需求是这样: 有多张表格, 每张表格有部分字段相同, 部分字段不同. 不同字段的单元格内容和样式也不尽相同. 所以想抽出一张公共表.能实现相同的字段的单元格内容和样式直接在公共表里定义完. 不同字段的单元格内容和样式 由在使用这张公共表的父组件中定义

感觉可能是
devui\data-table\data-table.component.ts

205 @ContentChildren(DataTableColumnTmplComponent) columns: QueryList<DataTableColumnTmplComponent>;

此处的columns

<...>
   <!--可获得-->
   <d-column ...></d-column>
   <!--动态部分无法获得-->
   <ng-content .....></ng-content>
   
</...>

因为是多级传递 ContentChildren无法获得到

from ng-devui.

qull avatar qull commented on May 18, 2024

Metadata Properties: descendants或许可以解决这个问题

from ng-devui.

qiuhaohui163 avatar qiuhaohui163 commented on May 18, 2024

以其他方式解决了
还是谢谢大佬的回答

from ng-devui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.