Useage of onRowClick not clear


#1

Hello,

I have a table, once cliked on the row I’d like to delete coresponding database entry and reload the view.

Code:
$t_activ->onRowClick(function ($f) use ($t_activ,$cuid,$m,$uid) {
$_temp=$f->jsRow()->data(‘id’);
$m->addCondition(‘gc_UsersDCS_playerid’,$_temp);
$m->addCondition(‘gc_UsersDCS_userid’,$uid);
$m->LoadAny();
$m->Delete();
});

The problem is that loading clicked value by f->jsRow()->data(‘id’); is not doing a trick, any advice how to pull the clicked ow id into this function ?

Thanks and Regards


#2

Fourth argument to “on” allow to pass arguments to a callback from JS. Something like this:

                $table->on('click', 'tr', function($j, $id) use($bl, $v){

                    return 'Clicked '.$id;

                }, [(new \atk4\ui\jQuery())->data('id')]);

#3

Thank you Sir, worked perfectly! :slight_smile: