table view customizations
Posted: 2016-07-15 03:30
I've seen a few questions about this, so after finally digging into it myself -- I thought I'd share.
Basically, the following code hooks/tablename-tv.js tweaks a few column headings and adds a breadcrumb.
One of the major annoyances of AG is that, once you've opened a table, then a detail record, then child records - there's no clean way to get back to the parent detail record.
This hook fixes that.
When this is implemented, and you drill into order items from an order detail view, then the child (order items) table view will have two icons/titles above it - one that takes you back to the orders record where you came from, and the other will switch you to a global order items view (same as AG has always done.)
Of course, you can tweak the hook. Drop the image. Alter the url. Don't add a new <a> tag, but alter the existing one. Just depends on your skills with jquery. And google
Enjoy!
Basically, the following code hooks/tablename-tv.js tweaks a few column headings and adds a breadcrumb.
One of the major annoyances of AG is that, once you've opened a table, then a detail record, then child records - there's no clean way to get back to the parent detail record.
This hook fixes that.
Code: Select all
// hooks/order_items-tv.js
$j(function(){
// right align a couple of table headers
$j('th.order_items-quantity').addClass('text-right');
$j('th.order_items-amount').addClass('text-right');
// add a back-to-orders link if item table view with a filter set
var view=$j('#current_view').val();
var id=$j('input[name="filterer_orders_id"]').val()*1;
if(view=='TV' && id>0){
var linktext='<a style="text-decoration: none; color: inherit;" href="orders_view.php?SelectedID='+id+'"><img src="resources/table_icons/cart.png"> Orders </a> ';
$j('a[href="order_items_view.php"]').before(linktext);
}
});
Of course, you can tweak the hook. Drop the image. Alter the url. Don't add a new <a> tag, but alter the existing one. Just depends on your skills with jquery. And google
Enjoy!