-
Notifications
You must be signed in to change notification settings - Fork 428
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
Pinned rows [Feature request / Suggestion] #406
Pinned rows [Feature request / Suggestion] #406
Comments
It is a good idea. |
I think this will require a second query to be run in order to have proper performance on big datasets. |
The "Pinned rows" concept means rows that match a criteria are always on the top of results. You can see this concept on Twitter also on Telegram: https://telegram.org/blog/pin-and-ifttt For example I would like to pin 'book rows' on my app: https://uf.ctrl-alt-d.net/material/tot/ I think a second query set is not needed, just not to opposite order on checked columns:
'*' means that is a pinned column, then order is always by '-is_a_book':
|
I think that must work on two data group:
Example: class Table(tables.Table):
def get_pinned_data(self, *args, **kwargs):
return SomeModel.objects.filter(......)
or
return [{'firstname':'John', 'lastname':'Brown', {.....}]
class Meta:
model = Simple
|
jieter, what you think about my proposition? |
This looks like a nice interface to define the table, I have some thoughts/concerns:
|
I think that the best solution would be if I prepare a proposal branch with code. sorry for my English |
I started work on this issue. |
Great!
…On 30 January 2017 22:33:48 CET, K2 ***@***.***> wrote:
I started work on this issue.
I reviewed code and I change my proposition.
Changing in templates are not required.
When I finish I push my code to my repository to "pinned_rows"
branche, then you tell what you think ok?
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#406 (comment)
|
Hi, https://github.com/djk2/django-tables2/tree/pinned-rows-406 |
Looks promising, please open the PR, that'll make reviewing the code easy. |
* Implemented Pinned Rows for issue: #406 * Tests for pinned rows * Amendments after a code review * Changes suggested by `felixxm` * Test - ValueError exception when data for pinned rows are not iterable * Documentation for code by docstrings. * little fixes * Documentation for pinned rows * little fixes in docs * Fixes after rebase on master
Fixed by #406 |
Would be wonderful to allow pinned rows parameter. Pinned rows will appear always on top. May be something like this:
On rendering,
order_by
sequence will bepinned_by
(unmodified) +order_by
(with reverse if needed).Sorry if this is not the way to suggest improvements.
The text was updated successfully, but these errors were encountered: