How to hide the default col in ColVis Js

How to hide the default col in ColVis Js

ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

Hi In my table there is 95 col, so displaying i am using datatable js file so now i wont to display only first 5 col at a first time and when your click on the hide show buttone at that time enable the selected col, for hide show i am use the ColVis Js file

Please Give me suggestion, Thanks

This question has accepted answers - jump to:

Answers

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Use the columns.visible option to set a default.

    Allan

  • ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

    thanks @allan its working, also once minor bug i am facing now list of 90 fields is displaying so long list so how to change the look and filed of col list any idea ??

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    At the moment you would need to modify the ColVis CSS. I'm working on a replacement to ColVis at the moment that will have built in support for multiple columns. It should be available in the next few weeks.

    Allan

  • ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

    yes i am trying to change the css but what actually problem i am facing is in the main Ul element (ColVis_collection) having inline css so its make trouble me is there any way using java-script or property i can overwrite my css on UL eliminate

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    The !important flag in a stylesheet will override the inline CSS applied by ColVis, or you would need to modify the script.

    Allan

  • ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

    thanks @allan but i am not able to success using this is there any demo example and once more question i need to store the hide or show col list in cookies, how to store i know but how to get the list of hide and show list in the java-script + datatable is there any way i can find the list of show col

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    The visible columns are automatically stored by DataTables if you enable the stateSave option (it uses localStorage rather than cookies).

    Allan

  • ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

    Yes Its working but i need to store this in database so where value store in the local storage can you suggested me or how to get only value because next time i need to show user to same fields, if i use this one its same value store for all user

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin
    Answer ✓

    If you need to store the state information in a database, take a look at the stateSaveCallback and stateLoadCallback options. I don't really understand for your description why you need to store it in a database rather than localStorage, but those options provide the ability to do it.

    Allan

  • ChiragGuravChiragGurav Posts: 6Questions: 1Answers: 0

    Yes, i am working on stateSaveCallback and stateLoadCallback, my requirement is user wise store the table configuration so i need to store state information in the database, other wise what happen if i use localstore then more then one use from same browser getting same configuration that's why,

    BTW thanks for supporting me, now i am implementing and post you is any query

This discussion has been closed.