Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Column Ordering (MVC/JQuery) #7405


User avatar
0
sean.alford created

How do you enable the user to change column order?


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Do you need to remember the user-adjusted table column order after refreshing?

  • User Avatar
    0
    sean.alford created

    Yes, the user settings will need to be persistant from once session to the next.

  • User Avatar
    0
    maliming created
    Support Team

    This will probably require the application to store the user's order of the table columns. And read these settings when the page is initialized and then call the datatables api to set the order of the columns.

    Abp provides settings management components https://aspnetboilerplate.com/Pages/Documents/Setting-Management

    However, this is not a simple feature, because you have to consider that the columns of the table may be added or removed in the future. This may cause the application to maintain the settings invalid.

    My personal suggestion: You can store the column name and order store in the user's settings. The set name can be a table name, then get the settings and adjust the order in the front end.(https://datatables.net/reference/api/colReorder.move%28%29)

    Set the name: User-datatable Settings Values:

    {
    "name": 1,
    "sex": 2
    }