X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/direct/php/classes/TestAction.php diff --git a/examples/direct/php/classes/TestAction.php b/examples/direct/php/classes/TestAction.php index 77a83d1d..51de29d6 100644 --- a/examples/direct/php/classes/TestAction.php +++ b/examples/direct/php/classes/TestAction.php @@ -33,4 +33,68 @@ class TestAction { } return $out; } + + function getGrid($params){ + $sort = $params->sort[0]; + $field = $sort->property; + $direction = $sort->direction; + + /* + * Here we would apply a proper sort from the DB, but since + * it's such a small dataset we will just sort by hand here. + */ + + if ($field == 'name') { + $data = array(array( + 'name'=>'ABC Accounting', + 'turnover'=>50000 + ), array( + 'name'=>'Ezy Video Rental', + 'turnover'=>106300 + ), array( + 'name'=>'Greens Fruit Grocery', + 'turnover'=>120000 + ), array( + 'name'=>'Icecream Express', + 'turnover'=>73000 + ), array( + 'name'=>'Ripped Gym', + 'turnover'=>88400 + ), array( + 'name'=>'Smith Auto Mechanic', + 'turnover'=>222980 + )); + } else { + $data = array(array( + 'name'=>'ABC Accounting', + 'turnover'=>50000 + ), array( + 'name'=>'Icecream Express', + 'turnover'=>73000 + ), array( + 'name'=>'Ripped Gym', + 'turnover'=>88400 + ), array( + 'name'=>'Ezy Video Rental', + 'turnover'=>106300 + ), array( + 'name'=>'Greens Fruit Grocery', + 'turnover'=>120000 + ), array( + 'name'=>'Smith Auto Mechanic', + 'turnover'=>222980 + )); + } + if ($direction == 'DESC') { + $data = array_reverse($data); + } + return $data; + } + + function showDetails($data){ + $first = $data->firstName; + $last = $data->lastName; + $age = $data->age; + return "Hi $first $last, you are $age years old."; + } }