# prevent column reordering

**URL:** <https://forum.servoy.com/t/prevent-column-reordering/16216>\
**Category:** Classic Servoy\
**Created:** [July 17, 2012, 3:50pm UTC](https://forum.servoy.com/t/prevent-column-reordering/16216 "2012-07-17T15:50:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewbrice](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@matthewbrice](https://forum.servoy.com/u/matthewbrice)\
**Post date:** [July 17, 2012, 3:50pm UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/1 "2012-07-17T15:50:29Z")

</div>

I have seen this question asked before but not recently. With the introduction of v6.1 is there a way to prevent the reordering of columns in table view?

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 17, 2012, 8:55pm UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/2 "2012-07-17T20:55:49Z")

</div>

Hi Matt,

When you attach a method to the onSort event, one line of code will be generated that takes care of the sorting:

```auto
function onSort(dataProviderID, asc, event) {
	controller.sort(dataProviderID + (asc ? ' asc' : ' desc'), false)
}

```

Just comment out that line and sorting will be no more. If you want to do something else instead you can code that in the same method.

Regards,

---

<div class="post-metadata">

**Author:** ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)\
**Post date:** [July 18, 2012, 6:33am UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/3 "2012-07-18T06:33:41Z")

</div>

I think he means, re-ordering columns, not sorting columns

---

<div class="post-metadata">

**Author:** ![jdbruijn](https://avatars.discourse-cdn.com/v4/letter/j/ed8c4c/32.png) [@jdbruijn](https://forum.servoy.com/u/jdbruijn)\
**Post date:** [July 18, 2012, 6:51am UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/4 "2012-07-18T06:51:47Z")

</div>

You can use the field anchors to control how the size and position of the fields can be modified by the user. If you want to prevent the user to modify the order of the columns then you have to anchor them to the bottom. If you want to have certain columns always at the left side of the tableview anchor them top-left-bottom, or at the right side of the tableview use anchors top-right-bottom.  
Just play around with these options to see how they work.

---

<div class="post-metadata">

**Author:** ![omar](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@omar](https://forum.servoy.com/u/omar)\
**Post date:** [July 18, 2012, 8:39am UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/5 "2012-07-18T08:39:02Z")

</div>

> Harjo:  
> I think he means, re-ordering columns, not sorting columns

Oops, sorry about that. For what it’s worth: the portal has a reorderable property you can set to false but that won’t do you any good in this form.

---

<div class="post-metadata">

**Author:** ![matthewbrice](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@matthewbrice](https://forum.servoy.com/u/matthewbrice)\
**Post date:** [July 18, 2012, 2:12pm UTC](https://forum.servoy.com/t/prevent-column-reordering/16216/6 "2012-07-18T14:12:35Z")

</div>

Thank you all for the responses.

Yes, I did mean re-ordering of columns, not sorting. But that was an excellent tip all the same. Good to know.

I will give the anchoring a try.
