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

[FEATURE] - add links property to the NextAdminOptions to control which field should be linked to the “edit” page #383

Open
shifenhutu opened this issue Aug 27, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@shifenhutu
Copy link

Summary

i am sorry for that my english is bad

i hope should be linked to the edit page when i click specific field, not the full line

my idea is from django-admin list_display_links https://docs.djangoproject.com/en/5.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display_links

Basic Example

example:


import { NextAdminOptions } from "@premieroctet/next-admin";
 
export const options: NextAdminOptions = {
 
  model: {
    User: {
      toString: (user) => `${user.name} (${user.email})`,
      title: "Users",
      icon: "UsersIcon",
      list: {
        display: ["id", "name", "email", "posts", "role", "birthDate"],
        search: ["name", "email"],
        links: ["id", "name"],  // now when i click id or name, i will go to the edit page
      // if i don't add the links property( default case ), when i click the full line , i will go to the edit page
      },
    },
  },
};
 

Drawbacks

No response

Unresolved questions

No response

@shifenhutu shifenhutu added the enhancement New feature or request label Aug 27, 2024
@foyarash foyarash self-assigned this Sep 2, 2024
@foyarash
Copy link
Collaborator

foyarash commented Sep 2, 2024

Hello @shifenhutu

Thanks for the suggestion. Could you give me a possible use case for this ? I cannot figure out in which case you'd like to be able to click only on a cell instead of the whole row.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants