Modify Table View

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Modify Table View

Post by angus » 2022-09-08 13:36

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;
AppGini 22.13

User avatar
D Oliveira
AppGini Super Hero
AppGini Super Hero
Posts: 347
Joined: 2018-03-04 09:30
Location: David

Re: Modify Table View

Post by D Oliveira » 2022-09-09 08:05

you can filter the table, get the url param, after condition met add .css or javascript in hooks/footer-extras.php

angus
Veteran Member
Posts: 128
Joined: 2020-05-28 22:27

Re: Modify Table View

Post by angus » 2022-09-09 17:07

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")

});
AppGini 22.13

Post Reply