table/filter
< >

return function () {
    $self = url('/@object/@action/' . urlencode('table/filter'));
    // 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">' . (isset($_GET['row'])
        ? t('Button <b>%act</b> of row <b>%row</b> was clicked (the demo only shows it).', ['%act' => $act, '%row' => (int) $_GET['row']])
        : t('Button <b>%act</b> was clicked (the demo only shows it).', ['%act' => $act])) . '</div>' : '';
    $data = json_decode(file_get_contents(__DIR__ . '/products.json'), true);
    return $notice . table($data, [
            'filter' => true,
            'filter_params' => [
                'name' => 'like',
                'price' => 'between',
            ],
        ])
        ->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')
        ->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]);
};
Image Name Cat id Price Quantity Add date Actions
Archives T-shirt, black 10077 37.00 0 09/27/13 Edit Delete Clone Активний
Archives T-shirt, navy 10077 37.00 0 09/30/13 Edit Delete Clone Активний
Archives T-shirt, purple 10077 37.00 0 10/02/13 Edit Delete Clone Активний
Attacker T-shirt, white 10077 37.00 0 09/29/13 Edit Delete Clone Активний
Blamo T-shirt, black 10077 37.00 0 10/01/13 Edit Delete Clone Активний
Blamo T-shirt, white 10077 37.00 0 10/03/13 Edit Delete Clone Активний
Blamo T-shirt, black and green 10077 37.00 0 09/27/13 Edit Delete Clone Активний
Paint Bucket T-shirt, green 10077 37.00 0 09/28/13 Edit Delete Clone Активний
Paint Bucket T-shirt, white 10077 37.00 0 09/30/13 Edit Delete Clone Активний
Paint Bucket T-shirt, purple 10077 37.00 0 09/28/13 Edit Delete Clone Активний
Flash T-shirt, white 10077 35.00 0 09/27/13 Edit Delete Clone Активний
Mix Tape T-shirt, black 10077 45.00 0 09/29/13 Edit Delete Clone Активний
Winner T-shirt, grey 10077 35.00 0 10/02/13 Edit Delete Clone Активний
Hill T-shirt, white 10077 35.00 0 10/01/13 Edit Delete Clone Активний
Roseheart T-shirt, black 10077 35.00 0 Edit Delete Clone Активний
Liberty T-shirt, black 10077 35.00 0 Edit Delete Clone Активний
Pray Skull T-shirt, black 10077 35.00 0 Edit Delete Clone Активний
Blood Head T-shirt, black 10077 40.00 0 Edit Delete Clone Активний
Outlaw T-shirt, black 10077 40.00 0 Edit Delete Clone Активний
Random T-shirt, black 10077 40.00 0 Edit Delete Clone Активний