$form->onSubmit() with internally celled Columns


Hello, I’m learning Agile Toolkit and I’ve decided to make a variant of the ToDo list example by using internally celled columns instead of the classic table, however I’m stuck on 2 things:

  1. If I want to programatically add a new $row inside form->onSubmit(), how can I define it if I can’t pass it as argument like use($col_reload) ???

  2. How can I display the current model value (in this case $m[‘post’] ) inside a specific cell ?? More precisely in $row->addColumn([14, ‘NEED FIX’]);

    <?php require 'vendor/autoload.php';

    $app = new\atk4\ui\App(‘Minimal Blog’);

    $s = new \atk4\data\Persistence_Array($_SESSION);

    class MyPosts extends \atk4\data\Model {
    public $table = “posts”;
    function init() {
    $this->addField(‘post’, [‘required’=>true]);

    $m = new MyPosts($s);

    $form = $app->add(‘Form’);

    $app->add([‘Header’, ‘My Posts’]);
    $col = $app->add(new \atk4\ui\Columns([‘internally celled’]));
    $col_reload = new \atk4\ui\jsReload($col);

    $form->onSubmit(function($form) use($col_reload, $col) {

     $row = $col->addRow();
     $row->addColumn([2, date("d-m-Y H:i:s")])->add(['Icon', 'huge comment outline']);
     $row->addColumn([14, 'NEED FIX']);
     return $col_reload;