protected function loadData()
    {
        if (is_null($this->filteredData)) {
            $this->filteredData = $this->filterHelper->filterData(
                $this->data,
                $this->filters,
                FilterInterface::FILTER_LOGIC_OR
            );

            if (!is_null($this->sort)) {
                $sort = $this->sort;
                uasort($this->filteredData, function ($a, $b) use ($sort) {
                    if (is_numeric($a[$sort[0]])) {
                        $comp = ($a[$sort[0]] < $b[$sort[0]]) ? -1 : 1;
                    } else {
                        $comp = (strcmp($a[$sort[0]], $b[$sort[0]]));
                    }

                    if ($sort[1] == "DESC") {
                        return -1 * $comp;
                    } else {
                        return $comp;
                    }

                });
            }
        }
    }
protected function loadData()
    {
        if (is_null($this->filteredData)) {
            $this->filteredData = $this->filterHelper->filterData(
                $this->data,
                $this->filters,
                FilterInterface::FILTER_LOGIC_OR
            );

            if (!is_null($this->sort)) {
                $sort = $this->sort;
                uasort($this->filteredData, function ($a, $b) use ($sort) {
                    if (is_numeric($a[$sort[0]])) {
                        $comp = ($a[$sort[0]] < $b[$sort[0]]) ? -1 : 1;
                    } else {
                        $comp = (strcmp($a[$sort[0]], $b[$sort[0]]));
                    }

                    if ($sort[1] == "DESC") {
                        return -1 * $comp;
                    } else {
                        return $comp;
                    }

                });
            }
        }
    }
protected function loadData ( ) { if ( is_null ( $ this -> filteredData ) ) { $ this -> filteredData = $ this -> filterHelper -> filterData ( $ this -> data , $ this -> filters , FilterInterface :: FILTER_LOGIC_OR ) ; if ( ! is_null ( $ this -> sort ) ) { $ sort = $ this -> sort ; uasort ( $ this -> filteredData , function ( $ a , $ b ) use ( $ sort ) { if ( is_numeric ( $ a [ $ sort [ 0 ] ] ) ) { $ comp = ( $ a [ $ sort [ 0 ] ] < $ b [ $ sort [ 0 ] ] ) ? - 1 : 1 ; } else { $ comp = ( strcmp ( $ a [ $ sort [ 0 ] ] , $ b [ $ sort [ 0 ] ] ) ) ; } if ( $ sort [ 1 ] == "DESC" ) { return - 1 * $ comp ; } else { return $ comp ; } } ) ; } } }
Filter & sort the data.
Filter & sort the data .