<commit_before><?php namespace Zofe\Rapyd\DataGrid;


use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\View;
use Zofe\Rapyd\DataSet as DataSet;
use Zofe\Rapyd\DataGrid\Column as Column;
use Zofe\Rapyd\Exceptions\DataGridException;

class DataGrid extends DataSet
{

    protected $fields = array();
    public $columns = array();
    public $rows = array();
    public $output = "";
   
    public function add($name, $label = null, $orderby = false)
    {
        $column = new Column($name, $label, $orderby);
        $this->columns[] = $column;
        return $this;
    }

    public function build($view='')
    {
        parent::build();

        foreach ($this->columns as & $column) {
            if (isset($column->orderby)) {
                $column->orderby_asc_url = $this->orderbyLink($column->orderby, 'asc');
                $column->orderby_desc_url = $this->orderbyLink($column->orderby, 'desc');
            }
        }
        $this->rows = $this->data;
        
        foreach ($this->data as $tablerow) {
            
            foreach ($this->columns as $column) {
                
                var_dump($tablerow);
                die;

                //$column->setRow($tablerow);
                //$cell = get_object_vars($column);
                //$cell["value"] = $column->getValue();
                $row[] = $cell;
                
            }
            $this->rows[] = $row;
            unset($row);
        }
        if ($view == '') $view = 'rapyd::datagrid';
        return View::make($view, array('dg' => $this));
    }

    public function getGrid($view='')
    {
        $this->output = $this->build($view);
        return $this->output;
    }

}<commit_msg>fix now datagrid should extend and instance dataset using ::source<commit_after><?php namespace Zofe\Rapyd\DataGrid;


use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\View;
use Zofe\Rapyd\DataSet as DataSet;
use Zofe\Rapyd\DataGrid\Column as Column;
use Zofe\Rapyd\Exceptions\DataGridException;

class DataGrid extends DataSet
{

    protected $fields = array();
    public $columns = array();
    public $rows = array();
    public $output = "";
   
    public function add($name, $label = null, $orderby = false)
    {
        $column = new Column($name, $label, $orderby);
        $this->columns[] = $column;
        return $this;
    }

    public function build($view='')
    {
        parent::build();

        foreach ($this->columns as & $column) {
            if (isset($column->orderby)) {
                $column->orderby_asc_url = $this->orderbyLink($column->orderby, 'asc');
                $column->orderby_desc_url = $this->orderbyLink($column->orderby, 'desc');
            }
        }
        $this->rows = $this->data;
        
        foreach ($this->data as $tablerow) {
            
            foreach ($this->columns as $column) {
                
                if (is_object($tablerow) && !property_exists($tablerow, $column->name))

                //$column->setRow($tablerow);
                //$cell = get_object_vars($column);
                //$cell["value"] = $column->getValue();
                $row[] =  $tablerow->{$column->name};
                
            }
            $this->rows[] = $row;
            unset($row);
        }
        if ($view == '') $view = 'rapyd::datagrid';
        return View::make($view, array('dg' => $this));
    }

    public function getGrid($view='')
    {
        $this->output = $this->build($view);
        return $this->output;
    }

}
{'fraction_non_alphanumeric': 0.15845764142977764, 'fraction_numerical': 0.0, 'mean_word_length': 1.9396195202646815, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4994948', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1066, 'n_words': 213}