abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.84k stars 3.42k forks source link

Datatable fnSetColumnVis legacy method usage issue #20970

Open muhlisatac opened 1 week ago

muhlisatac commented 1 week ago

Is there an existing issue for this?

Description

I'm getting "tableInstance.fnSetColumnVis is not a function at hideColumnWithoutRedraw" error when there is only 1 rowAction item and its visibility is related to a permission check. If the user doesn't have that permission error occurs. I think root of the error is related to fnSetColumnVis legacy datatable method used in [datatables-extensions.js].(https://github.com/abpframework/abp/blob/6a810dbed50f8b8d9a8e0914f56825ac6922ef20/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js#L229).

Reproduction Steps

    columnDefs: [
            {
                title: "",
                rowAction: {
                    items:
                        [
                            {
                                text: 'Edit',
                                visible: function (data) {
                                    return abp.auth.isGranted('Acme.Test.Edit')
                                },
                                action: function (data) {
                                    editModal.open({ id: data.record.id });
                                }
                            },
                        ]
                }
            },
            {
                title: 'Test',
                data: "test"
            }
]

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

8.3.1

User Interface

MVC

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

maliming commented 1 week ago

hi

What is the package version in your packages.json file?

muhlisatac commented 1 week ago

"@abp/aspnetcore.mvc.ui.theme.shared": "~8.3.1",

maliming commented 1 week ago

Thanks,Can you share a test project?

muhlisatac commented 1 week ago

https://we.tl/t-rr5jNDkzqp . Just remove book update permission from the admin role then look at the books page.

realLiangshiwei commented 1 day ago

@muhlisatac

Hi, could you share the project again?

image
muhlisatac commented 1 day ago

https://we.tl/t-ttRvq66TF7. Sure here you are.