SHARE
TWEET

Untitled

a guest Oct 23rd, 2019 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3.  
  4. require '../vendor/autoload.php';
  5.  
  6. use atk4\ui\App;
  7.  
  8. $app = new App();
  9. $app->initLayout('Centered');
  10.  
  11. $test_data = [
  12.     ['name'=>'record1','value'=>'100','datum_field'=>new DateTime('2019-09-29')],
  13.     ['name'=>'record2','value'=>'200','datum_field'=>new DateTime('2019-09-28')],
  14.     ['name'=>'record3','value'=>'300','datum_field'=>new DateTime('2019-09-30')],
  15.     ['name'=>'record4','value'=>'400','datum_field'=>new DateTime('2019-10-01')],
  16. ];
  17.  
  18. $table = $app->add('Table');
  19. $table->setSource($test_data);
  20. $table->addHook('beforeRow',function($table){
  21.     if ($table->current_row['value']==100){
  22.         $table->t_row->template[0] = "\n  <tr class=\"red\" data-id=\"";
  23.  
  24.     }elseif ($table->current_row['value']==200){
  25.         $table->t_row->template[0] =  "\n  <tr class=\"green\" data-id=\"";
  26.     }else{
  27.         $table->t_row->template[0] = "\n  <tr data-id=\"";
  28.     }
  29. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top