簡體   English   中英

如何更改 ng2 智能表格列寬?

[英]How to change ng2 smart table column width?

這是我的三列的示例。 我想自定義寬度大小。

resetPassword: {
    title: this.gridTittle["ResetPassword"],
    type: 'custom',
    renderComponent: UserPasswordResetComponent,
    filter: false
},
userName: {
    title: this.gridTittle["UserName"],
},
roleTypeDescription: {
    title: this.gridTittle["UserType"],
    type: 'text',
    filter: false
},

您可以使用寬度屬性。 作為文檔“列寬示例:'20px','20%'” 在您的代碼中:

resetPassword: {
    title: this.gridTittle["ResetPassword"],
    type: 'custom',
    renderComponent: UserPasswordResetComponent,
    filter: false,
    width: 25%
},
userName: {
    title: this.gridTittle["UserName"],
    width: 25%
},
roleTypeDescription: {
    title: this.gridTittle["UserType"],
    type: 'text',
    filter: false,
    width: 50%
},

重要 >> 這個引號之間的寬度

columns: {
      id: {
        title: '#',
        type: 'string',
        sortDirection: 'desc',
        width: '30px'
      },
      name: {
        title: 'Nome',
        type: 'string',
      },
      lastName: {
        title: 'Sobrenome',
        type: 'string',
      },
      username: {
        title: 'Usuário',
        type: 'string',
      }
}

我無法使其與 column 屬性一起使用。
我的解決辦法是:

:host {
  ::ng-deep .yourColumnName .ng2-smart-title {
    width: 100px;
  }
}

或者

:host {
  ::ng-deep .ng2-smart-title {
    min-width: 150px;
  }
}

你在這里有一個線程

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM