Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require '../vendor/autoload.php';
- use atk4\ui\App;
- $app = new App();
- $app->initLayout('Centered');
- $test_data = [
- ['name'=>'record1','value'=>'100','datum_field'=>new DateTime('2019-09-29')],
- ['name'=>'record2','value'=>'200','datum_field'=>new DateTime('2019-09-28')],
- ['name'=>'record3','value'=>'300','datum_field'=>new DateTime('2019-09-30')],
- ['name'=>'record4','value'=>'400','datum_field'=>new DateTime('2019-10-01')],
- ];
- $table = $app->add('Table');
- $table->setSource($test_data);
- $table->addHook('beforeRow',function($table){
- if ($table->current_row['value']==100){
- $table->t_row->template[0] = "\n <tr class=\"red\" data-id=\"";
- }elseif ($table->current_row['value']==200){
- $table->t_row->template[0] = "\n <tr class=\"green\" data-id=\"";
- }else{
- $table->t_row->template[0] = "\n <tr data-id=\"";
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement