小编Eug*_*kov的帖子

跟踪 TypeScript 中的参数类型

我为我的一些实体在 TypeScript 中实现了构建器模式。这是其中之一(为简单起见,将其删除),也在操场上

type Shape = any;
type Slide = any;
type Animation = any;

export class SlideBuilder {

  private slide: Slide;

  public static start() { return new SlideBuilder(); }

  public withShape(name: string, shape: Shape): this {
    this.slide.addShape(name, shape);
    return this;
  }

  public withAnimation(name: string, animation: Animation): this {
    this.slide.addAnimation(name, animation);
    return this;
  }

  public withOrder(shape: string, animations: string[]) {
    this.slide.addOrder(shape, animations);
    return this;
  }
}

SlideBuilder
  .start()
  .withShape("Hello World", {})
  .withAnimation("Animation1", {})
  .withAnimation("Animation2", {})
  .withOrder("Could be 'Hello …
Run Code Online (Sandbox Code Playgroud)

types builder typescript

4
推荐指数
1
解决办法
214
查看次数

未捕获的TypeError:无法读取未定义的dataTable的属性"className"

我有桌子:

HTML

<table id="mydata">
    <thead>
        <tr>
            <th>Data 1</th>
            <th>Data 2</th>
            <th>Data 3</th>
            <th>Data 4</th>
        </tr>
    </thead>
    <tbody>
        <tr class="main">
            <td class="data_1">A</td>
            <td class="data_2">B</td>
            <td class="data_3">C</td>
            <td class="data_4">D</td>
        </tr>
   </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

当我使用dataTable与jquery排序时:

JavaScript的

jQuery('#mydata').dataTable({
    "sDom": " ",
    "bPaginate": false,
    "bInfo": false,
    'bFilter':false,                        
    "aoColumns": [
        null,               
        null,
        null,
        null
    ]
});
Run Code Online (Sandbox Code Playgroud)

它奏效了.

但是,当我为main添加子行时:

HTML

<table id="mydata">
    <thead>
        <tr>
            <th>Data 1</th>
            <th>Data 2</th>
            <th>Data 3</th>
            <th>Data 4</th>
        </tr>
    </thead>
    <tbody>
        <tr class="main">
            <td class="data_1">A</td>
            <td class="data_2">B</td>
            <td class="data_3">C</td>
            <td class="data_4">D</td>
        </tr> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery jquery-plugins datatables jquery-datatables

1
推荐指数
1
解决办法
9677
查看次数