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

render_A_Link_Column #412

Open
C-BERBER opened this issue Feb 8, 2017 · 6 comments
Open

render_A_Link_Column #412

C-BERBER opened this issue Feb 8, 2017 · 6 comments

Comments

@C-BERBER
Copy link

C-BERBER commented Feb 8, 2017

I'm not sure if I am just not using it properly but my interface is very reliant on taking every value from the table and calling a link to edit said row... The problem is that I am now having to compromise my model to format data that should be done in a presentation layer.

So I guess my ask is this (if it doesn't already exist) have a way for the row to trigger a Link and/or allow the render to render before the link makes it's text entry..

first_name        = tables.LinkColumn('contact', text=lambda record: record.first_name,
                                    args=[A('pk')], verbose_name='First Name', accessor='pk', attrs={'class': 'edit'})
last_name         = tables.LinkColumn('contact', text=lambda record: record.last_name,
                                    args=[A('pk')], verbose_name='Last Name', accessor='pk', attrs={'class': 'edit'})
primaryEmail      = tables.LinkColumn('contact', text=lambda record: record.primaryEmail,
                                  args=[A('pk')], verbose_name='Primary Email', accessor='pk', attrs={'class': 'edit'})

The easier option would be for me to just render the three together from the record into one column link.

Otherwise it is a great package
Thanks
CB

@jieter
Copy link
Owner

jieter commented Feb 12, 2017

I'm not quite sure what your questions is exactly. Seems to be more like a question for help, but this is an issue tracker to report bugs and request features. Please use stackoverflow to ask questions and tag your question with django-tables2.

@jieter jieter closed this as completed Feb 12, 2017
@C-BERBER
Copy link
Author

That was a feature request, unless it already existed...
... "So I guess my ask is this (if it doesn't already exist)"

@jieter jieter reopened this Feb 12, 2017
@jieter
Copy link
Owner

jieter commented Feb 12, 2017

@C-BERBER Can you try to rephrase your feature request?

@C-BERBER
Copy link
Author

Sure Sorry,

Feature is to Separate the appearance of the data from the underlying linkage.

Either:
have the render_COLUMN get called from the LinkColumn soley to override the text. maybe it becomes render text but with the record being passed in...

[Right now the render_COLUMN overrides the base function completely.]

Or:

Take the link column idea to the entire row (no text) and thus let render_COLUMN do its thing..

End result would be the same.
Render each column as a link but with some abstracted presentation method for the text.

Hope that was a little more clear.
Cheers and this is really a great little library..

@jieter
Copy link
Owner

jieter commented Aug 23, 2017

I've been thinking about this lately: If every column has the ability to become clickable, that could be much clearer than the current set of options. We should think of use cases where the column 'text' already returns a link/button: Wrapping it in <a>-tags, wouldn't make sense. But maybe that's something a developer should just not do...

@jieter
Copy link
Owner

jieter commented Jul 16, 2018

@C-BERBER I've been working on a branch which might fix this, can you have a look at the API proposed in #590 ?

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

No branches or pull requests

2 participants