Hi guys, i try to explain my problem.
I use spring mvc framework (jsp + controller) i need to visualize different numbers of columns in my jsp, based on logged user role
i paste my code:
JSON object from controller response
JSP page:
a number of aoColumns and my TH columns will be different as user role for example:
User_A will see the first 3 columns of aoColumns and the relative TH column
User_B will see the first 6 columns of aoColumns and the relative TH column
User_C can see all columns
I can make TH column dynamical visualization using Spring Security tag but i have no idea how to generate aoColumns dynamically
I use spring mvc framework (jsp + controller) i need to visualize different numbers of columns in my jsp, based on logged user role
i paste my code:
JSON object from controller response
{"iTotalDisplayRecords":10, "iTotalRecords":10, "sEcho":1, "aaData":[{"numeroPolizza":"aaaa", "codiceVoucher":"bbbbbbbbbb", "codicePratica":"72", "brand":"ccccc", "attivita":"dddddddd", "data":"05/02/2013", "status":"Non Elaborata", "statusImpianto":"N/D", "agenzia":"eeeeeeee", "ldapUsername":"fffffffffff", "id":123, "action":{ "revoke":true, "edit":true, "open":true, "reprint":true}} ]}
JSP page:
$(function() { var oTable = $('#tableArchive').dataTable({ "bProcessing" : true, "bJQueryUI" : true, "bServerSide": true, "sPaginationType" : "full_numbers", "sAjaxSource" : "/prod-doAjaxCall.htm", "aoColumns": [ { "mData": "numeroPolizza", "sName": "numeroPolizza", "bSortable": true, "bVisible": true }, { "mData": "codiceVoucher", "sName": "codiceVoucher", "bSortable": true, "bVisible": true }, { "mData": "codicePratica", "sName": "codicePratica", "bSortable": true, "bVisible": true }, { "mData": "brand", "sName": "brand", "bSortable": false, "bVisible": true }, { "mData": "attivita", "sName": "attivita", "bSortable": false, "bVisible": true }, { "mData": "data", "sName": "data", "bSortable": true, "bVisible": true }, { "mData": "status", "sName": "status", "bSortable": false, "bVisible": true }, { "mData": "statusImpianto", "sName": "statusImpianto", "bSortable": false, "bVisible": true }, { "mData": "id", "sName": "id", "bSortable": false, "bVisible": false }, { "mData": "action", "sName": "action","bSortable": false,"bVisible": true, "sClass": "archiveAction", "mRender": function ( data, type, full ) { //JAVASCRIPT LOGIC }, { "mData": "agenzia", "sName": "agenzia", "bSortable": false, "bVisible": true}, { "mData": "utente", "sName": "agenzia", "bSortable": false, "bVisible": true}, ] }); }); <table cellpadding="0" cellspacing="0" border="0" class="display" id="tableArchive" width="100%"> <thead> <tr> <th>numeroPolizza</th> <th>codiceVoucher</th> <th>codicePratica</th> <th>brand</th> <th>attivita</th> <th>data</th> <th>status</th> <th>statusImpianto</th> <th> </th> <th>action</th> <th>agenzia</th> <th>utente</th> </tr> </thead> <tbody> </tbody> <tfoot> </tfoot> </table>
a number of aoColumns and my TH columns will be different as user role for example:
User_A will see the first 3 columns of aoColumns and the relative TH column
User_B will see the first 6 columns of aoColumns and the relative TH column
User_C can see all columns
I can make TH column dynamical visualization using Spring Security tag but i have no idea how to generate aoColumns dynamically