Ordering Models by Weight with CJuiSortable

Comparing #1 with #2

Revision #2 was created by Matt Kelliher Matt Kelliher on Mar 11, 2010, 2:10:50 AM.

Typo...

Content

In this tutorial we will be setting up a content type to be ordered by weight using the JUI Sortable plugin. *Note: This is probably not suitable for large data sets, as each model is updated on submission.*

**Tutorial Requirements**
[...]
// Set the number of models to be the heaviest weight
// and format into a dropDownList-friendly array
$models =
BlogYourClass::model()->findAll();

for ($i = 0; $i < sizeof($models); $i++) { $weights[$i] = $i; }

echo CHtml::activeDropDownList($model, 'weight', $weights);
?>
[...]