45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
require_once __DIR__ . '/vendor/autoload.php';
|
|
|
|
use PHPNative\Framework\Application;
|
|
use PHPNative\Ui\Widget\Container;
|
|
use PHPNative\Ui\Widget\Table;
|
|
use PHPNative\Ui\Window;
|
|
|
|
$app = new Application();
|
|
$window = new Window('Table Scroll Test', 800, 600);
|
|
|
|
// Simple container with limited height
|
|
$mainContainer = new Container('flex flex-col bg-gray-100 p-4');
|
|
|
|
// Table with max height
|
|
$table = new Table('h-96'); // 384px max height
|
|
$table->setColumns([
|
|
['key' => 'id', 'title' => 'ID', 'width' => 100],
|
|
['key' => 'name', 'title' => 'Name', 'width' => 400],
|
|
['key' => 'status', 'title' => 'Status', 'width' => 120],
|
|
]);
|
|
|
|
// Test data with 63 entries (same as your example)
|
|
$testData = [];
|
|
for ($i = 1; $i <= 63; $i++) {
|
|
$testData[] = [
|
|
'id' => $i,
|
|
'name' => "Server-{$i}",
|
|
'status' => ($i % 3 === 0) ? 'stopped' : 'running',
|
|
];
|
|
}
|
|
$table->setData($testData);
|
|
|
|
$mainContainer->addComponent($table);
|
|
|
|
$window->setRoot($mainContainer);
|
|
$app->addWindow($window);
|
|
|
|
echo "Table Scroll Test started!\n";
|
|
echo "- Table should show scrollbar\n";
|
|
echo "- Try scrolling with mouse wheel over the table\n\n";
|
|
|
|
$app->run();
|