How to rearrange columns programatically in flat form ?

Re-Open

Hi Team,
 
I need to maintain column order in flat form and currently pivot takes the order in which headers are present in JSON object. JSON doesn’t maintain order and that’s why I need to set the order programatically.
 
How can I do that with flexmonster ?
 
Thanks

3 answers

Public
Tanya Gryshko Flexmonster May 16, 2018

Hello, Ganesh,
Thank you for writing to us.
The column order is defined when you specify the slice. For example, please open this demo: https://jsfiddle.net/flexmonster/17y8edL8/5/. At line 11 you can see that “Quantity” is added first, then “Price” and “Color”. The same order is shown on the grid. If the order in the slice is changed, the order on the grid will change as well.
Does the suggested approach work for you?
Regards,
Tanya

Public
Ganesh Modak June 11, 2018

Hi Tanya,
Thanks for the answer.
The approach you suggested does not work for us as expected, The order we specified in the slice object is not replicated on UI (columns are displayed in any random sequence).
 
What we are doing is we first call updateData() api with partial false on some external event, where we are adding/removing columns dynamically and then we set slice object with desired order of columns mentioned:
flexmonster.updateData({data: ” + data + “}, {partial: false”});
flexmonster.runQuery(‘” + slice + “‘); 
 
What we are expecting is that the columns should be displayed in the exact sequence that is mentioned in the slice object.
 
We add/remove columns dynamically in updateData() call.
 
Can you please look into the issue ?
 
Thanks
Ganesh

Public
Dmytro Zvazhii Flexmonster June 11, 2018

 
Hello Ganesh,
Thank you for your feedback. Could you please have a look at the following jsffidle example: http://jsfiddle.net/flexmonster/pz431qp5/53/? Does it match your needs?
Waiting to hear from you.
Regards,
Dmytro

Please login or Register to Submit Answer