d-man
d-man

Reputation: 58103

JSF2.0 richfaces 4.x Jquery

I have my inputText in the form i can get its value by the following code

<h:inputText value="hello world" id="myidtest" />

alert($(#{rich:element('myidtest')}).val());

If i put my inputText under rich:datatable then alert($(#{rich:element('myidtest')}).val());

gives undefined after some r&D i found that rich:elment reference not returning object if it is under rich:datatable

any quick help appriciated

Upvotes: 0

Views: 775

Answers (1)

Sully
Sully

Reputation: 14943

That is because each column will have a different generated id

Use columns tag to set the id based on the column index

<rich:columns value="#{dataTableScrollerBean.columns}" var="columns" index="ind" id="column#{ind}">

The generated id will look like id="formId:tableId:rowIndex:column1"

then you can use

jQuery(#{rich:element('formId:tableId:rowIndex:column1')}).

If that does not work post the generated html for that element.

Upvotes: 1

Related Questions