【问题标题】:How can I move the delete action to the last column in an ng2 smart table?如何将删除操作移动到 ng2 智能表的最后一列?
【发布时间】:2019-09-12 22:43:47
【问题描述】:

如何将删除操作移动到“ng2”智能表的最后一列?

我想在我的ng2 智能表中的表的最后一列中进行唯一的删除操作。有人可以帮我解决这个问题吗?

我使用的表的设置和代码如下:

this.settings = {
                add: {
                    confirmCreate: true,
                    addButtonContent: '<i class="fa fa-plus" title="Add"></i>',
                    createButtonContent: '<i class="fa fa-save" title="Save"></i>',
                    cancelButtonContent: '<i class="fa fa-remove" title="Cancel"></i>'
                },
                delete: {
                    confirmDelete: true,
                    deleteButtonContent: '<i class="fa fa-trash" title="Delete"></i>'
                },
                edit: {
                    confirmSave: true,
                    editButtonContent: '<i class="fa fa-edit" title="Edit"></i>',
                    saveButtonContent: '<i class="fa fa-save" title="Save"></i>',
                    cancelButtonContent: '<i class="fa fa-remove" title="Cancel"></i>'
                },
                columns: {
                    logDate: {
                        title: 'Log Date*',
                        filter: false,
                        type: 'custom',
                        width: '5%',
                        renderComponent: DatePickerRenderComponent,
                        editor: {
                            type: 'custom',
                            component: DatePickerEditorComponent,
                        },
                    },
                    category: {
                        filter: false,
                        title: 'Category*',
                        type: 'html',
                        editor: {
                            type: 'list',
                            config: {
                                list: this.customerList,
                            },
                        },
                    },
                    partId: {
                        filter: false,
                        title: 'PN/ID#*'
                    },
                    description: {
                        filter: false,
                        title: 'Description'
                    },

                    ws: {
                        filter: false,
                        title: 'WS',
                        type: 'custom',
                        renderComponent: CheckboxRenderComponent,
                        editor: {
                            type: 'custom',
                            component: CheckboxEditorComponent
                        }
 };

【问题讨论】:

    标签: html css angular angular-material2 ng2-smart-table


    【解决方案1】:

    使用文档中描述的属性actions.position

    actions.position'left'|'right'选择动作列位置

    例子:

    actions.position: 'right',
    add: {
        confirmCreate: true,
        addButtonContent: '<i class="fa fa-plus" title="Add"></i>',
        createButtonContent: '<i class="fa fa-save" title="Save"></i>',
        cancelButtonContent: '<i class="fa fa-remove" title="Cancel"></i>'
    },
    

    【讨论】:

    • 但这会将所有动作移动到右侧,但我只想删除以向右移动
    • 我认为由于他的限制/建议,使用智能表是不可能的。
    • 我们可以在列标题旁边放一个红色的星号来显示该字段为必填项吗?
    猜你喜欢
    • 1970-01-01
    • 2018-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多