column visibility by role based

column visibility by role based

robinblogspotrobinblogspot Posts: 3Questions: 1Answers: 0

how to visible column role based.

            `<th width="6%" id="role"></th>`

    columnDefs : [
      { targets: 11, visible: document.getElementById('role').value == '[ROLE_ADMIN]' }
    ],

it's Not working properly

Answers

  • robinblogspotrobinblogspot Posts: 3Questions: 1Answers: 0

    I have tried with php but not working

                                    <th>PgNo</th>
                                    <th>Serial</th>
                                    <th>To</th>
                                    <th>Inv Number</th>
                                    <th width="1%"></th>
                                    <?php if($role == ROLE_ADMIN) { ?>
                                    <th width="6%"></th>
                                    <?php  } ?>
    
  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • robinblogspotrobinblogspot Posts: 3Questions: 1Answers: 0

    i got these errors

    jQuery.Deferred exception: n[q] is undefined
    TypeError: n[q] is undefined
    

    I have already mentioned columnDefs 11 orderable false

        `"columnDefs":[ { "targets":[10,11], "orderable":false, }, ],`
    

    i have removed 11 from orderable

    now its working fine Thanks

This discussion has been closed.