Well, you're also going to need to know the capacity of those drives, so you'll need that field as well. However, let's suppose you don't want to store the %full / %empty values and would rather calculate those as needed.
At the beginning of our model, we need to add a variable declaration.
In the CDbCriteria section of the sort function within the model, we're going to add the following:
$criteria->compare('(t.used / t.capacity * 100)', $this->fill_pct);
Then, in the CGridview, we can add something like this:
'name' => 'fill_pct',
'value' => '@(sprintf(%d", $data->used / $data->capacity * 100))',
Now, we can filter things like…