Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Want to add multiple buttons per line in list view support 希望列表视图可以每行增加多个按钮 #26026

Open
lioooooh opened this issue Apr 18, 2024 · 0 comments · May be fixed by #26162

Comments

@lioooooh
Copy link

lioooooh commented Apr 18, 2024

It is now supported to add one action button per line, but sometimes one button is not enough. I hope to support adding multiple buttons.
// 现在已经支持在每一行添加一个操作按钮了,但是有时一个按钮是不够的,希望可以支持添加多个按钮

frappe.listview_settings['Note'] = {
    // add a custom button for each row
    button: {
        show(doc) {
            return doc.reference_name;
        },
        get_label() {
            return 'View';
        },
        get_description(doc) {
            return __('View {0}', [`${doc.reference_type} ${doc.reference_name}`])
        },
        action(doc) {
            frappe.set_route('Form', doc.reference_type, doc.reference_name);
        }
    },
}

Following the above code, I add two buttons, which do not take effect, in fact, the last one prevails.
按照上面代码,我添加两个button,并不会生效,实际上是一最后一个为准的

frappe.listview_settings['Note'] = {
    // add a custom button for each row
    button: {
        show(doc) {
            return doc.reference_name;
        },
        get_label() {
            return 'View';
        },
        get_description(doc) {
            return __('View {0}', [`${doc.reference_type} ${doc.reference_name}`])
        },
        action(doc) {
            frappe.set_route('Form', doc.reference_type, doc.reference_name);
        }
    },
    // add **another** custom button for each row
    button: {
        show(doc) {
            return doc.reference_name;
        },
        get_label() {
            return 'View';
        },
        get_description(doc) {
            return __('View {0}', [`${doc.reference_type} ${doc.reference_name}`])
        },
        action(doc) {
            frappe.set_route('Form', doc.reference_type, doc.reference_name);
        }
    },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant