Show no. of columns according to user rights
Show no. of columns according to user rights
prats
Posts: 45Questions: 21Answers: 0
I want use datatable feature for following scenario.
1)It contains 1 single report but different visible columns for different users.
2)when user clicks on link to open report, report should show only those columns that are assigned to him i.e only visible columns
3) and when user log out to account it should save previous state .Is it possible as I am new to jquery n javascript
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Most or all of it should be possible. I did something similar: depending on what page you are on some columns are shown or hidden. Same logic if you do this based on user rights. Here is my little example.
- Outside datatables set classes depending on what page you are on:
This is the HTML for the datatable:
In column definitions of the respective table I have this. As you can see some columns are always hidden others only depending on what page you are on.
I also make sure that the "hiddenForThis" columns cannnot be made visible with the colvis button (whereas the "hiddenCols" can be made visible with that button.)
You can also add classes through the datatables API but there is a bug in the current official release, see below: https://datatables.net/forums/discussion/comment/107810/#Comment_107810
@rf1234 thanks for response but I am getting data from web service so is it possible for this?
why should the data source matter? This is purely Javascript and HTML ...
Please see this on data sources: https://datatables.net/examples/data_sources/index.html
So I used this solution that works fine for me.
Thanks