ui icon indicating copy to clipboard operation
ui copied to clipboard

Adding simple redirect action button in CRUD is hard

Open DarkSide666 opened this issue 8 years ago • 6 comments
trafficstars

If we want to add button column in CRUD which will simply navigate away to another page and pass rows ID, then it's not that trivial to do. Also need to add custom JavaScript.

Currently we can do that like this:

$c->addAction(
    new \atk4\ui\Icon('money'),
    new \atk4\ui\jsExpression(
        'document.location="money.php?friend_id="+$(this).closest("tr").data("id");'
    )
);

DarkSide666 avatar Apr 26 '17 12:04 DarkSide666

See pr #156, with that you could do:

$c->addAction(['icon'=>'money'], function($js, $id) { return .... });

Also per style you should use Link if user is taken to another page.

romaninsh avatar May 11 '17 10:05 romaninsh

Do we have example of this in docs? If yes then I think this issue can be closed. If no, then maybe we should add example in docs.

DarkSide666 avatar Jul 29 '19 21:07 DarkSide666

Is there a simple solution for this in the meantime? ATK is cool for some reason. However I'm always getting stuck with the simplest of things after a few minutes. Sorry for "venting" here but it's not really user- and especially not beginner-friendly if you're stuck all the time and the best examples you find (even if it doesn't do what you like) are the unit tests in the code :( That probably scares a lot of people away, otherwise this would rock.

TheNetworkIsDown avatar Apr 22 '20 23:04 TheNetworkIsDown

However I'm always getting stuck with the simplest of things after a few minutes.

I suffered with this also years ago when I was starting to dive in Agile Toolkit libraries :) Nowadays i think it's much better, but still such cases can happen and should be addressed.

DarkSide666 avatar Apr 24 '20 11:04 DarkSide666

@DarkSide666 what is currently the best option and how can this be improved?

mvorisek avatar Oct 02 '22 19:10 mvorisek

Money class - https://github.com/atk4/ui/blob/5d1bf4c4/src/Table/Column/Money.php should allow currency field to be specified like in CountryFlag class - https://github.com/atk4/ui/blob/5d1bf4c4/src/Table/Column/CountryFlag.php

mvorisek avatar May 16 '23 08:05 mvorisek