table/rotate
< >

return function () {
    $self = url('/@object/@action/' . urlencode('table/rotate'));
    // the row buttons link back here: the demo only reports the click, nothing is edited
    $act = preg_replace('~[^a-z]~', '', (string) ($_GET['act'] ?? ''));
    $notice = $act ? '<div class="alert alert-info">Button <b>' . $act . '</b>' . (isset($_GET['row']) ? ' of row <b>' . (int) $_GET['row'] . '</b>' : '') . ' was clicked (the demo only shows it).</div>' : '';
    $data = json_decode(file_get_contents(__DIR__ . '/products.json'), true);
    return $notice . table($data, [
            'rotate_table' => 1,
            // the demo id holds a slash: the pager of array data takes its base url from extra.url_path
            'extra' => ['url_path' => $self . '?'],
        ])
        ->image('id', 'uploads/shop/products/{subdir2}/{subdir3}/product_%d_1_thumb.jpg', ['width' => '50px'])
        ->text('name')
        ->link('cat_id', url('/@object/@action/' . urlencode('table/products')), _class('cats')->_get_items_names('shop_cats'))
        ->text('price')
        ->text('quantity')
        ->date('add_date')
        ->date('add_date', ['format' => '%y-%m-%d %H:%M'])
        ->btn_edit(['icon' => 'icon-star', 'link' => $self . '?act=edit&row=%d', 'no_ajax' => 1])
        ->btn_delete(['link' => $self . '?act=delete&row=%d', 'no_ajax' => 1])
        ->btn_clone(['link' => $self . '?act=clone&row=%d', 'no_ajax' => 1])
        ->btn_active(['link' => $self . '?act=active&row=%d'])
        ->footer_add(['link' => $self . '?act=add', 'no_ajax' => 1]);
};
Button delete of row 10060 was clicked (the demo only shows it).
Archives T-shirt, black Archives T-shirt, navy Archives T-shirt, purple Attacker T-shirt, white Blamo T-shirt, black Blamo T-shirt, white Blamo T-shirt, black and green Paint Bucket T-shirt, green Paint Bucket T-shirt, white Paint Bucket T-shirt, purple
10077 10077 10077 10077 10077 10077 10077 10077 10077 10077
37.00 37.00 37.00 37.00 37.00 37.00 37.00 37.00 37.00 37.00
0 0 0 0 0 0 0 0 0 0
09/27/13 09/30/13 10/02/13 09/29/13 10/01/13 10/03/13 09/27/13 09/28/13 09/30/13 09/28/13
13-09-27 12:26 13-09-30 17:08 13-10-02 10:57 13-09-29 15:34 13-10-01 11:01 13-10-03 01:38 13-09-27 04:52 13-09-28 16:35 13-09-30 23:18 13-09-28 22:52
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active
Edit
Delete
Clone
Active