Enable/Disable Export buttons

Enable/Disable Export buttons

rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
edited August 2013 in TableTools
Hi all,

Can you tell me how to enable/disable export buttons ? because according to my requirements , all the users should not be allowed for export results into XL . Instead only admin users can be allowed for export . so can you tell me how to achieve that?

!!!!!!!!!PLEASE HELP ME!!!

Raja.S
Bangalore

Replies

  • aaronwaaronw Posts: 89Questions: 3Answers: 4
    So, the first question at hand is how are you identifying users? How does your application work in that context? are users logged in using cookies or are they logged in using HTTP_AUTH? How do you know which users are admins and which are not?
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Thanks Aaronw, for your help.. Here is my scenario

    I am working on asp.net application. So obviously, I use session values at Page_Load.. so here is my sample C# code

    If ( session["PermissonCode"].ToString() =="XXX" )
    ExportButton.Enabled=false

    I am trying to achieve the above scenario with Tabletools in clientside so, I can store the permission value in hidden field. !!!!please help me!!!! Thanks again,
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    The easiest way is to simply not initialise TableTools when not admin. Since you have the information available in your C# code if they are admin or not, just output that in a Javascript variable and use that as a flag to initialise (or not) TableTools.

    Allan
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Thanks Allan,

    but according to my requirements in case of non admin users, they can still view the DataTable , but they should not export it. Please give some help..

    Regards
    Raja.S
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Yes, so as I said - when non-admin, just don't initialise TableTools. Always initialise DataTables, but conditionally enable TableTools.

    Allan
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Great Allan, I got it.

    If you don't mind can you provide some code snippets that dealing with conditionally enable TableTools ? or any links?

    Thanks a lot..
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Allan,

    Any updates please...
  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    [code]
    if ( admin ) {
    new TableTools( oTable );
    }
    [/code]

    You just need to get the admin variable from your server process.

    Allan
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Thank you Allan,
  • rajarajananisrajarajananis Posts: 29Questions: 0Answers: 0
    Great, The issue has been fixed with the help of Allan.. I keep learning it, Great plug-in.

    Thank you all
This discussion has been closed.