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

Some kind of default column hide/show template tag #29

Closed
ScottEAdams opened this issue Dec 12, 2013 · 0 comments
Closed

Some kind of default column hide/show template tag #29

ScottEAdams opened this issue Dec 12, 2013 · 0 comments

Comments

@ScottEAdams
Copy link

I have no idea how this would/whether this should be implemented but thought I would throw it in the ideas pile.

At the moment I use http://bootstrap-switch.org/ to create a really nice show/hide column filter. Basically I include a template above my table that looks something like this:

<div class="column-switch">
    <div class="switch-label">Column 1</div>
    <div id="column-1-switch" class="make-switch switch-small" data-on="success"
         data-off="warning"
         data-on-label="<i class='icon-ok icon-white'></i>"
         data-off-label="<i class='icon-remove'></i>">
        <input type="checkbox" class="toggle" value="column-1"/>
    </div>
</div>
<div class="column-switch">
    <div class="switch-label">Column 2</div>
    <div id="column-2-switch" class="make-switch switch-small" data-on="success"
         data-off="warning"
         data-on-label="<i class='icon-ok icon-white'></i>"
         data-off-label="<i class='icon-remove'></i>">
        <input type="checkbox" class="toggle" value="column-2"/>
    </div>
</div>

etc, etc

Then I have in my js:

$('#column-1-switch').on('switch-change',function (e, data) {
    var value = data.value;
    changeColumnVisibility(0, value);
}).bootstrapSwitch('setState', true);

$('#column-2-switch').on('switch-change',function (e, data) {
    var value = data.value;
    changeColumnVisibility(1, value);
}).bootstrapSwitch('setState', true);

Which basically lets the user turn on/off the visibility of the column. I guess something along these lines as an optional templatetag would be handy i.e. {% datatableview_columnvisibility %}

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

No branches or pull requests

2 participants