We will create grid that will show rows from DB table users used in the previous examples.
First create a subdir named "users" in hidden/inc/grids/. In there create file users_grid.class.php
<?php
require_once(TANGRA_MAIN_DIR.'grids/sp_grid_wlc.class.php');
class Users_Grid extends SP_Grid_WLC {
function __construct() {
parent::__construct('users', 'users.php', 2, 20); // 2 columns and 20 rows
$this->add_link_col('edit', 'user_edit.php', 'user_obj_id'); // adding link column
// $this->generate_html();
}
public function set_rows(&$rows) { //overloading method because we wand third parameter to be false (i.e. don't skip used column)
$this->set_rows_and_link_cols_rows_from_raw_rows($rows, 0, false);
}
public function generate_html() { // used just once to generate grid's HTML
print_r_pre(htmlentities($this->get_static_html('modules/grid_html_tpl_static_ajax_metallic_en/','en')));
}
}
For more information about SP_Grid_WLC class please see the » API reference.