Responsive Shows hidden columns again - Page 2

Responsive Shows hidden columns again

2»

Answers

  • JakeHulseJakeHulse Posts: 11Questions: 0Answers: 0

    @allan,

    I understand now that class name none does what YOU expect it to do; however, I hope this 'little' thread shows that it does not do what WE expect it to do. The fact of the matter is that setting the column visible = false hides the column and data when non-responsive; however, breaks when the table is responsive, and that is a bug.

    I suggest updating the code to keep visible = false consistent or updating the documentation to indicate none means the "column will not be visible... ; however, the data will be visible in the child row."

    Thank you for your time on this and the wonderful tool!

  • JakeHulseJakeHulse Posts: 11Questions: 0Answers: 0

    @Lintz: I just implemented the changes you outlined and they worked perfectly! Thank you sir!

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Yes, as I noted further up the thread I realise that this isn't the desirable behaviour (although it is correct at the moment!). I will be addressing it in a update to Responsive in future - possibly to add a new class called never which would remove it from both.

    Having said that, I still maintain a much better solution (both for performance and accessibility) is to simply not have data that you don't want to be visible in the table not in a column.

    Thanks for the feedback.

    Allan

  • JakeHulseJakeHulse Posts: 11Questions: 0Answers: 0

    @allan,

    Sorry I missed your note and I am glad to hear that you are planning to add the new class (what are your thoughts on Lintz's solution?).

    I agree that not including the data is better, but as I said earlier, that isn't a solution for me. I need the data and cannot modify the value used for aoColumnDefs since that is set by the MVC tool I am using. Modifying that would be far more difficult then I have time for right now.

    Thanks again,
    Jake

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Looks like a fair change, although not quite compatible with what I will probably implement (the never class) - unless I, or someone comes up with a better idea! I would like to retain the possibility of using the current behaviour.

    Allan

  • robovrobov Posts: 31Questions: 5Answers: 0

    For me the never class would be the perfect solution, then I can decide to never show it or just in the responsive expand box

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Committed. Will be available in the 1.0.2 release and is now in the nightly.

    Allan

  • JakeHulseJakeHulse Posts: 11Questions: 0Answers: 0

    @allan,

    That is awesome. I will grab and let you know if I have any issues with it.

    Great job and thank you!
    Jake

  • rpmccormickrpmccormick Posts: 107Questions: 13Answers: 0
    edited November 2014

    Hi Allan. I had the same issue as Jake, thank you for creating the "never" class.

    I want to do more though... is it at all possible to specify how the responsive works in detail?

    EDITED:

    What I would like to be able to do is give each column an "importance" number. If it is negative, then it will always be hidden under the (+) expand box, if it is 0 things will behave as they do now, and a positive number says how important it is.

    When the window is getting bigger and the responsive plugin is adding columns, it would add the column with the biggest importance first.

    When the window is getting smaller and the responsive plugin is removing columns, it would remove all the importance="0" (default) columns first, starting with the rightmost one, just as it does now. Then when all the "0" are gone it would remove the rightmost "1", and so forth.

    Thanks,
    -RPM

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Hi,

    Nice idea with the importance number. At the moment the priority is defined simply in left to right column order. I'll consider adding this for a future release though.

    Regards,
    Allan

  • ZurielZuriel Posts: 1Questions: 0Answers: 0

    The "importance" weight is CRUCIAL for how we want to use datatables. the priority from left to right is a bad idea because you are assuming that things on the LEFT are the most important. For some applications the Left is the least important, for others the middle portion is the least important, but forcing the visibility based on class is bad because sometimes you may have room even thought you've told the table via class no. yet by doing it with width / priority / etc you allow the table to always show the most important items and hide the least.

    I am hesitant to write a row renderer or something that does this for fear that future changes / optimizations / improvements will render this null. We are already having issues where we set the control to the far right column, hide the far left column with min-mobile and then the left row doesn't show at all and the code breaks.

    I think the importance weight system would be a improvement. Alternatively it would be great to have importance per breakpoint.

    Another big misconception is that tables are 100% width. Alot of times my tables are in a smaller Div on desktop and then get reflowed to 100% on mobile, but that doesn't mean my table is 100% on desktop. So I may have a different order of importance on a "small" datatable on desktop, vs a "small" datatable on mobile.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Thanks for the feedback. This is most certainly something that I want to add in future. At the moment I'm working on other things, but hope to implement this in the next major upgrade of Responsive.

    Allan

  • Cédric_HCédric_H Posts: 1Questions: 0Answers: 0

    Hi.

    I'm currently trying to make a grid that contains a hidden column 'key' and I still didn't found a correct solution.
    In fact, I would like to have a column that acts like a column with the class 'never' where it is possible to access to its value.
    Maybe I missed something and it's already possible but I didn't found how to do it.
    Thanks for your help.

    Cédric

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    I would like to have a column that acts like a column with the class 'never' where it is possible to access to its value

    That is exactly what never does. You should still be able to access the data using the API - specifically row().data().

    If that doesn't work for you, please link to a test case showing the issue.

    Allan

  • BelphemurBelphemur Posts: 1Questions: 0Answers: 0

    Hello,
    I understand for now visible != never.
    But could you add a method in the responsive API to be able to set the className dynamically the same way we can set the visibility ?

    I modified the old script hiding empty column, and find a workaround by setting the class "never" dynamically on the TH of the column I want to hide ... but with pure jquery.

    This the reason why I ask for a method in the api to do the same.

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    But could you add a method in the responsive API to be able to set the className dynamically the same way we can set the visibility ?

    You can use jQuery to add the class to the header cell for the column and then use responsive.rebuild() to rebuild the cached classes Responsive holds.

    Allan

  • 7TLaravel7TLaravel Posts: 2Questions: 0Answers: 0
    edited April 2015

    I used the 'never' className but it still triggers the expansion image to appear, but there's no data in the child-row (only the image changes from a + into a -). Can this be fixed in some way?

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Looks like a bug. I'll check into it when I've done the rest of my "rounds" on the forums.

    Allan

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    edited April 2015

    Fix committed here. Example.

    It will be in the release that I'm going to be doing shortly.

    Thanks,
    Allan

  • beckTMbeckTM Posts: 1Questions: 0Answers: 0

    I would also like to give a +1 for being able to give importance to a column. Simply because when fully expanded, i would like a specific order for my columns, but that is not necessarily the order of importance.

  • FrancYescOFrancYescO Posts: 8Questions: 1Answers: 0

    Thanks for this thread :D

    news about "importance" number? i need a column (the last on the right..) to be not collapsed

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    Not yet - I've been working on other things for DataTables before being able to do this. It will be in the next major update for Responsive (not sure when that will be - hopefully not too far away).

    Allan

  • FrancYescOFrancYescO Posts: 8Questions: 1Answers: 0
    edited December 2015

    Allan do you have news for us? :)
    At least the hidden column that appear again seems fixed in last version,just asking if is possible to set the "priority" of a column

    EDIT: Seems i just found it: https://datatables.net/extensions/responsive/priority

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin

    That is correct - you can indeed set a priority in Responsive 2.x. There is a bug in the 2.0.0 release whereby using the data-priority attribute doesn't work - that has been fixed in the nightly and will be included in 2.0.1.

    Allan

This discussion has been closed.