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

Probmel with column visible and column bVisible settings #14

Closed
andrewshkovskii opened this issue Aug 30, 2013 · 4 comments
Closed

Probmel with column visible and column bVisible settings #14

andrewshkovskii opened this issue Aug 30, 2013 · 4 comments
Labels

Comments

@andrewshkovskii
Copy link

I'am using datatables 1.9.4, jquery 2.0.3.

I have problem with bVisible variable in columns settings:
I'am using this template for render table:

 <table class="datatable table table-condensed" data-url="{{ datatable.url }}" data-result-counter-id="{{ result_counter_id }}" id="type_of_work_list_table">
        <thead>
            <tr>
                {% for name, attributes in datatable %}
                    <th data-name="{{ name|slugify }}" {{ attributes }}>{{ name }}</th>
                {% endfor %}
            </tr>
        </thead>
 </table>

And this settings for view:

class DepartmentListView(DatatableView):
    model = Department
    template_name = "departments_list.html"
    datatable_options = {
        'columns': [
            (u"dep", 'title'),
            ""
        ],
    }

And it's result in table with header, containing in tbody and no data (td) in rows.
Why?
I'am output column options in django-datatables-view.js, and bVisible variable in it always false..

Object {undefined: "dep", bSortable: false, bVisible: false}
Object {undefined: "", bSortable: false, bVisible: false} 
@tiliv
Copy link
Contributor

tiliv commented Sep 3, 2013

I'm not certain if this is part of the issue or not, but what is the blank string "" for? It wouldn't be a valid column, and I'm wondering if the main datatables.js code is failing.

The original datatables.js is very very fragile, and it will just fail without warning if anything is wrong. I can't be sure if bVisible: false is because of DatatableView or if it's breaking inside of datatables.js itself.

I'll be busy for today, but soon I'd like to set up a sample environment for making a quick test out of this kind of thing. I know it's been a few days already, so I apologize for that. If you've come up with any other details, I'd be interested to hear them.

@tiliv
Copy link
Contributor

tiliv commented Sep 4, 2013

Something else that I just thought of, since I ran into settings that didn't seem to stick:

If you're using the state-saving plugin, you'll have to clear the jquery.dataTables.js cookie from that page in order to see changes to column settings. This always gets me when I least expect it. What ends up happening is that you can print the options and everything looks fine, and then datatables appears to ignore your settings.

For reference, if you're using state-saving, you'll have a few cookies that look like this:
screen shot 2013-09-04 at 1 12 56 pm

@tiliv
Copy link
Contributor

tiliv commented Sep 4, 2013

If this happens to be the problem, note that I've recently removed the bStateSave option from defaulting to true. If you want it, later on, the process for doing so is well-documented in the dataTables.js world.

cead2b8

@andrewshkovskii
Copy link
Author

Sorry, i'am at vacation right now, and can't give you any good example, but i will on next week.
The empty column ("") was for column with action buttons, it not needed a name or title/header.
BTW, i tried to play with different setting in incognito mode, and also disabled saveState, disabled cookies - it all was the same. BUT, i will try it on next week again and submit my report. Thank you for response.

@tiliv tiliv closed this as completed Dec 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants