diff options
Diffstat (limited to 'demos')
-rwxr-xr-x | demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php | 11 | ||||
-rwxr-xr-x | demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php index aeb30609..827558b8 100755 --- a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) diff --git a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php index 201fc5f9..766e4d55 100755 --- a/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php +++ b/demos/quickstart/protected/pages/Controls/Samples/TDataGrid/Sample4.php @@ -6,9 +6,14 @@ class Sample4 extends Sample2 { protected function sortData($data,$key) { - $compare = create_function('$a,$b','if ($a["'.$key.'"] == $b["'.$key.'"]) {return 0;}else {return ($a["'.$key.'"] > $b["'.$key.'"]) ? 1 : -1;}'); - usort($data,$compare) ; - return $data ; + usort($data, function($a, $b) use ($key) { + if ($a[$key] == $b[$key]) { + return 0; + } else { + return ($a[$key] > $b[$key]) ? 1 : -1; + } + }); + return $data; } public function sortDataGrid($sender,$param) |