angularng2-smart-table

How to change ng2 smart table column width?


This is a sample of my three columns. I want to customize the width sizes.

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
},

Solution

  • You can use the width property. As the documentation, "column width example: '20px', '20%'". In your code:

    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%
    },