cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Reordering/Rearranging Table Columns (sap.ui.table)

former_member243729
Participant
0 Kudos

Hi,

enableColumnReordering="true" works fine.

I am able to reorder the columns and they stay intact when I navigate between views. But when I refresh the page, the reordered sequence of the columns is lost and they are position back to normal. May I know how to have the columns re-ordered stay in their position even after page refresh ?

Here I am referring to sap.ui.table.

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member243729
Participant
0 Kudos

Thanks.

I understand theoretically how it works or how it should work, but looking for some high level direction from coding aspect.

devendervb
Contributor
0 Kudos

You have to use both way or defining at controller only.

when I say both,

1) Define in xmlview and it will any how instantiated before controllers init method triggers, so you can put a if condition that if local storage contains value, then refer to controller's(your defined table columns with reference to local storage)

else let it go naturally via view definition.

What do you say 🙂

devendervb
Contributor
0 Kudos

Re-Order refers to columns, When ever user reorders columns by drag and drop, check if you have any event which gets triggered on rearrange, and store the values in local storage.

Now, when your refreshes complete page , first check if data is available in local storage, if available write a code to arrange in the way, else let it go default.

former_member243729
Participant
0 Kudos

Would this work if table is generated in XML view (static way) or needs to be generated in controller (dynamic based on the column sequence information from local storage) ?

devendervb
Contributor
0 Kudos

You have to store the reorder data in browsers local storage or cache or applications of browser

then when you refresh it,before table renders on the page check if their is any data in local storage if there then rearrange accordingly.

Above logic you can write in onInit method as you are refeshing whole page.

former_member243729
Participant
0 Kudos

Thanks. May I know what you mean by re-order data ? Suppose if I have Student ID (Column 1) & Student Name (column 2) and if I re-order it to Student Name and Student ID...what kind of data will I have to save in local storage ?