Page 1 of 1

Textarea defaults to autogrow=false in PFM, why?

Posted: 01 Nov 2014, 00:04
by jobor
Hello,

I do have a mobile page for entering tekst in just 1 textarea field. The textarea did not grow larger by entering CR/LF as in the examples JQuery Mobile. I tried the all the attributes of p:inputTextarea. You can see this also on the PFM demo pages. I discoverd that PFM is setting the InputTextarea configuration autogrow to false (this.cfg.autogrow=false;) during the initialization.

Does anybody know the reason why this is done?

I succeeded to change the behaviour of the textarea to autogrow by adding the small initialization PrimeFaces Mobile JavaScript to my page.
After PFM has done the initialization this code replaces the PrimeFaces.widget.InputTextarea with the definition this.cfg.autogrow=true;
So after this is done JQuery Mobile is able to add autogrow functionality to the textarea field. And now I have this nice field without scrollbar. And I don't have to worry about the height.

Code: Select all

<ui:define name="page-script">
	<script>
		PrimeFaces.widget.InputTextarea=PrimeFaces.widget.BaseWidget.extend(
			{init: function(a) {
				this._super(a);
				this.cfg.enhanced=true;
				this.cfg.autogrow=true;
				this.jq.textinput(this.cfg);
			}
		});
	</script>
</ui:define>
But maybe there is a good reason why this.cfg.autogrow is set to false?

Gr. Johan Borchers

Re: Textarea defaults to autogrow=false in PFM, why?

Posted: 02 Nov 2014, 14:04
by smithh032772
Good question. I recognized that there were issues with (PrimeFaces Mobile 5.x) p:inputTextarea, so I am just using h:inputTextarea instead.