Page 1 of 1

Modify Table View

Posted: 2022-09-08 13:36
by angus
Hi everyone, I am trying to modify the table view

I have 2 fields, order1 and order2

I only want to show one field in the table view, either order1 or order2 depending on if there is a value, (both fields will never be filled only 1)

I found this on the tips page but it does not work, does anyone know why?

Code: Select all

// get the original fields array
			$oldFields = $options->QueryFieldsTV;
			
			// loop through all fields
			foreach($oldFields as $field => $title){
				// find the field that we need to customize
				if($field == '`account`.`order1`'){
					// apply custom SQL formatting to the field
					$modField = "IFNULL(`account`.`order1`,`account`.`order2`)";
					$newFields[$modField] = $title;
				}else{
					// for other fields, keep them unchanged
					$newFields[$field] = $title;
				}
			}
			
			// now apply the modified fields
			$options->QueryFieldsTV = $newFields;

Re: Modify Table View

Posted: 2022-09-09 08:05
by D Oliveira
you can filter the table, get the url param, after condition met add .css or javascript in hooks/footer-extras.php

Re: Modify Table View

Posted: 2022-09-09 17:07
by angus
Thanks D Oliveira, I actually found a great solution on jsetzer's site. You must have the AppGiniHelper but it it works really well.

jQuery(document).ready(function () {
AppGiniHelper.TV
.join("order1", ["order2"], "Order")

});