Skip to content

Commit

Permalink
Merge pull request #14 from spapas/patch-1
Browse files Browse the repository at this point in the history
Update README.rst to include API changes (from PR #11)
  • Loading branch information
djk2 authored Aug 31, 2018
2 parents e817e19 + b63a6ef commit 9e8b344
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ Screens:
:alt: screen 2


How Install:
-------------
How to Install:
---------------
1. Install django-tables2-column-shifter using::


Expand Down Expand Up @@ -144,6 +144,12 @@ To use app, you must inherit your table class from ``django_tables2_column_shift
{% extends "base.html" %}
{% load django_tables2 %}
{% render_table table %}
To retrieve the invisible columns you can use the ``$.django_tables2_column_shifter_hidden()`` API. You can either pass the 0-based index of the table in the page (i.e use ``$.django_tables2_column_shifter_hidden(1)`` to get the hidden columns for the 2nd table in the page) or just use it without parameters to retrieve the hidden columns for the first table. This API returns an array with the invisible column names.

These columns can then be used when you want to export only the visible columns, ie when the user clicks on the export button it would append an ``&excluded_columns=col1,col2`` to the export button's ``href`` which would then be used by the django-tables2 ``TableExporter`` (http://django-tables2.readthedocs.io/en/latest/pages/export.html#excluding-columns) to exclude these cols, i.e something like

exporter = TableExport('csv', table, exclude_columns=self.request.GET.get('excluded_columns').split(',))


Bootstrap2 (support for old projects):
Expand Down

0 comments on commit 9e8b344

Please sign in to comment.