public function sort(SS_HTTPRequest $r) {
		if($items = $r->getVar('item')) {
			foreach($items as $position => $id) {
				if($item = DataList::create($this->relationClass)->byID((int) $id)) {
					$item->SortOrder = $position;
					$item->write();
				}
			}
			return new SS_HTTPResponse("OK");
		}
	}
public function sort(SS_HTTPRequest $r) {
		if($items = $r->getVar('item')) {
			foreach($items as $position => $id) {
				if($item = DataList::create($this->relationClass)->byID((int) $id)) {
					$item->SortOrder = $position;
					$item->write();
				}
			}
			return new SS_HTTPResponse("OK");
		}
	}
public function sort ( SS_HTTPRequest $ r ) { if ( $ items = $ r -> getVar ( 'item' ) ) { foreach ( $ items as $ position => $ id ) { if ( $ item = DataList :: create ( $ this -> relationClass ) -> byID ( ( int ) $ id ) ) { $ item -> SortOrder = $ position ; $ item -> write ( ) ; } } return new SS_HTTPResponse ( "OK" ) ; } }
A controller action that handles the reordering of the list

@param SS_HTTPRequest
@return SS_HTTPResponse
A controller action that handles the reordering of the list