protected function build_rows() { $ci = get_instance(); $ci->load->helper('date'); $rows = array(); $custom_column_callback = $this->custom_columns_callback; if (!empty($custom_column_callback)) { $custom_column_callback($this->db_records); } foreach ($this->db_records as $record_index => $record) { // Current implementation uses numerically indexed array for rows, and uses headings to get field names for filters and sorting // Use column definitions to remove hidden values $rows[$record_index] = array(); $row_values = DatagridStructure::format_row_values(array_values($record)); foreach ($this->columns as $column_index => $column) { if ($column->visible_in_outputtypes !== false) { $rows[$record_index][] = $column_index == 0 ? reset($row_values) : next($row_values); } } } return $rows; }
protected function setup_structure() { $this->structure = DatagridStructure::get_structure(array('db_records' => $this->query_builder->get_db_records(), 'columns' => $this->columns, 'custom_columns_callback' => $this->custom_columns_callback)); }