ILIAS  release_8 Revision v8.24
without_data.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
6
11use Generator;
12
17function without_data(): string
18{
19 global $DIC;
20
21 $factory = $DIC->ui()->factory();
22 $renderer = $DIC->ui()->renderer();
23 $request = $DIC->http()->request();
24
25 $empty_retrieval = new class () implements DataRetrieval {
26 public function getRows(
27 DataRowBuilder $row_builder,
28 array $visible_column_ids,
29 Range $range,
30 Order $order,
31 ?array $filter_data,
32 ?array $additional_parameters
33 ): Generator {
34 yield from [];
35 }
36
37 public function getTotalRowCount(?array $filter_data, ?array $additional_parameters): ?int
38 {
39 return 0;
40 }
41 };
42
43 $table = $factory->table()->data(
44 'Empty Data Table',
45 [
46 'col1' => $factory->table()->column()->text('Column 1')
47 ->withIsSortable(false),
48 'col2' => $factory->table()->column()->number('Column 2')
49 ->withIsSortable(false),
50 ],
51 $empty_retrieval
52 );
53
54 return $renderer->render($table->withRequest($request));
55}
Both the subject and the direction need to be specified when expressing an order.
Definition: Order.php:13
A simple class to express a range of whole positive numbers.
Definition: Range.php:31
global $DIC
Definition: feed.php:28
$factory
Definition: metadata.php:75
without_data()
Example showing a data table without any data and hence no entries, which will automatically display ...