Get column order after columns have been moved

I'm trying to persist the column order after grid columns have been moved using drag and drop.  I can't find any attribute that reports the order of the columns in the  sfTreeGrid.  My goal is to be able to persist the column order and then reload the columns in that sequence when the app starts.  Thanks for any insights anyone can provide.


5 Replies

SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 20, 2024 04:17 PM UTC

Hi Bob Bachman,

To maintain the column order once the application gets reopened will be achieved only by using the serialization feature. But currently SfTreeGrid does not has the serialization support. So, We have analyzed and considered your requirement of “Provide Serialization support in SfTreeGrid” and logged feature request for the same. We will implement this feature in any of our upcoming release.

At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.

Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.

We will share the feedback details by tomorrow.

Regards,
Sreemon Premkumar M.



BB Bob Bachman replied to Sreemon Premkumar Muthukrishnan June 20, 2024 05:36 PM UTC

Thank you.  I thought I could track the changes myself using Column Dragging event however, the column names returned by using the e.From index value are not the name of the column dragged except for the first column drag event.  After that the names returned are based on the original layout.


private void treeGrid_ColumnDragging(object sender, TreeGridColumnDraggingEventArgs e) {


    if (e.To < 0) { return; }


    if (e.Reason != QueryColumnDraggingReason.Dropped) { return;}


    var colIndexFrom = e.From;

    var colIndexTo = e.To;

    var colNameFrom = TreeGrid.Columns[e.From].MappingName;

    var colNameTo = TreeGrid.Columns[e.To].MappingName;

    Debug.WriteLine(colNameFrom + " index: " + colIndexFrom + " moved to index: " + colIndexTo + " " + colNameTo) ;


}



SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 21, 2024 05:36 PM UTC

Hi Bob Bachman

We have checked the code snippet you provided, and the dragging column was properly retrieved using the e.from index. We have attached the tested sample with the video reference.

If we misunderstood your requirement, could you please provide more information regarding the reported issue with a video reference? This will help us validate the issue and provide a solution as soon as possible.

Regards,

Sreemon Premkumar M.


Attachment: SfTreeGrid_DragandDropColumns_2c78ed8e.zip


BB Bob Bachman June 23, 2024 12:10 AM UTC

Thank you very much - I appreciate your help.  It took me a while to understand the e.To column index.  In the attached program I've demonstrated how to use the ColumnDrag event to track the current column sequence.  It may be helpful to others trying to do the same thing while we wait for serialization to be added.


Attachment: SfTreeGrid_DragAndDropColumns_f97bfb5e.zip


SP Sreemon Premkumar Muthukrishnan Syncfusion Team June 24, 2024 04:39 PM UTC

Hi Bob Bachman,

Thanks for the update and we glad that the query gets addressed from your end.

Your requirement of “Serialization support for TreeGrid” and logged feature request for the same. We will implement this feature in any of our upcoming release.

At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.

Thank you for requesting this feature and helping us define it. We are always trying to make our products better and feature requests like yours are a key part of our product growth efforts.

Feedback linkhttps://www.syncfusion.com/feedback/58859/provide-serialization-support-in-sftreegrid

 If you have any more specification/suggestions to the feature request, you can add it as a comment in the portal and cast your vote to make it count.

Regards,

Sreemon Premkumar M.


Loader.
Up arrow icon