How-to limit # of row in textarea in table view with vertical scroll

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

How-to limit # of row in textarea in table view with vertical scroll

Post by wplim » 2015-06-26 05:49

I have a table with many columns to be displayed in table view.
However, one of the text field contains quite a bit text which dictates the height of each row.
Is there a way to limit the height of the textarea say max. of 5 lines and shows a vertical scroll bar if text is more than 5 lines?

WP

wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

Re: How-to limit # of row in textarea in table view with vertical scroll

Post by wplim » 2015-06-26 07:50

Here's my solution after a few trial and error with Appgini tutorial on "Customizing the data displayed in the table view"
http://bigprof.com/appgini/tips-and-tut ... eview-data

In my case, table is document, field is description.
The idea is to add a div layer over the description - <div style="max-height: 100px; overflow: auto;">description text</div>

Hope this will help other user.

Code: Select all

	function document_init(&$options, $memberInfo, &$args){
			// 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 == '`document`.`description`'){
					// apply custom SQL formatting to the field
					$modField = "CONCAT('<div style=\"max-height: 100px; overflow:auto;\">',`document`.`description`,'</div/>')";
					$newFields[$modField] = $title;
				}else{
					// for other fields, keep them unchanged
					$newFields[$field] = $title;
				}
			}
			
			// now apply the modified fields
			$options->QueryFieldsTV = $newFields;
		return TRUE;
	}
Attachments
vertical scrollbar.PNG
vertical scrollbar.PNG (11.14 KiB) Viewed 3417 times

Post Reply