Table sorting

CarCan asked 6 years ago

Hello gentlemen - 

nice job on the extension to the framework. I've started using the table feature. I see that I can turn the sorting on or off. But, is there a way to not do sorting on particular columns of a table?

 

Thanks!

Carlos


Piotr Glejzer staff answered 6 years ago

Hi CarCan,

thank you very much for appreciate.  About your question --> Yes, it is possible.

You can use this code to check it :

$('#your-id-of-your-table').DataTable({

"columnDefs": [{

"targets":0,

"orderable":false

}]

});
Let me know if you have more questions. Have a nice day.
 
Best,
Piotr

CarCan commented 6 years ago

Hello Piotr

Thank you, that worked perfectly!

I have an interesting problem for you, though. I use ASP.NET MVC and I have implemented the Identity feature for authentication and authorization. I am displaying columns based on "Roles", if a user logs in but is not in the "Admin" role, some columns do not display. The script that does the work to show the sorting, paging and filter does not work, as a result. If you have any idea on how to get around this, please let me know.

Carlos

 


Piotr Glejzer staff commented 6 years ago

hmm, I have bad news for your case, unfortunately, we don't support ASP.NET. I can't do anything because we don't have examples for that and we even didn't try to do this. Sorry about that.


CarCan commented 6 years ago

Thats ok, thank you for your response. If you want to support ASP.NET, I'd be glad to give you a solution that you can use to work with the issue.

However, this would seem a common issue when using authentication. In PHP, if a user is authenticated but not in a role like admin and the application removes a column, would the table sorting still work?

I appreciate you guys!!


Piotr Glejzer staff commented 6 years ago

Hi, 

It will be a pleasure if you will show us how to do this. :)

And we have some option about 'articles' where you can put your idea 'how to implement ASP.NET with MDBootstrap' or something like that. It will be amazing if somebody how is using ASP.NET will create articles about this.  I think it will help a lot of people. 

https://mdbootstrap.com/articles/

In PHP, it should not work how is it doing it on your example? Did you try it? 

Best,

Piotr

 

 

CarCan commented 6 years ago

Hello Piotr,

The way to do this would be to create partial views, display the appropriate view for the role. In the view the JS script will then work as designed. This way there is no need to edit code or make any changes to your framework.

 

Carlos


Piotr Glejzer staff commented 6 years ago

Thank you for the information. Have a nice day.


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.15
  • Device: desktop
  • Browser: any
  • OS: any
  • Provided sample code: No
  • Provided link: No
Tags