Utility Components |
||
|
Focus ComponentThe Focus component is a non-visual component that controls focus on the page. By using it, you can specify what component should be focused on page load and also save focus between page submissions. Note that there can be only one Focus component on the page. Specifying Focus ComponentTo add the Focus component to the page, use the <q:focus> tag. When this component is added, focus is saved automatically. It is important that all HTML and JSF tags have their ids specified to store focus between submissions by using the Focus component. The Focus component has a boolean autoSaveFocus attribute. By default, it is set to "true", which means that focus is saved between page submissions. <h:form>
<q:focus autoSaveFocus="true"/>
</h:form>
Specifying Focused Component on Page LoadYou can specify what component should be focused when the page is loaded using the focusedComponentId attribute. In this attribute, you should specify the id of the component to be focused. The focusedComponentId attribute supports Expression Language. The focusedComponentId attribute should be defined in the same way as the for property of the standard HTMLOutputLabel component:
<h:form id="form1"> <q:focus focusedComponentId="subview1:input1"/> ... <f:subview id="subview1"> <h:inputText id="input1"/> </f:subview> </h:form>
<h:form id="form1"> <q:focus focusedComponentId=":input"/> ... <input id="input" type="text"/> </h:form>
<h:form id="form1"> <q:focus focusedComponentId="treeTable"/> ... <q:treeTable id="treeTable" ...>...</q:treeTable> </h:form> If the autoSaveFocus attribute is set to "true", the id of the focused component is saved into the focusedComponentId attribute between page submissions. Tracking Focus For the Entire ApplicationYou can also specify the teamdev.jsf.autoSaveFocus context attribute in web.xml to "true" (the default is "false"). This attribute causes focus to be saved between form submissions for all application pages. <context-param>
<param-name>teamdev.jsf.autoSaveFocus</param-name>
<param-value>true</param-value>
</context-param>
Scroll Position ComponentThe ScrollPosition component is a non-visual component that controls the scroll position of the page. By using it, you can specify the position of the scroll when the page is loaded and save the scroll position between page submissions. Note that there can be only one ScrollPosition component on the page. Specifying Scroll Position ComponentTo add the ScrollPosition component on the page, use the <q:scrollPosition> tag. When this component is added, the scroll position is saved automatically. The ScrollPosition component has a boolean autoSaveScrollPos attribute. By default, it is set to "true", which means that the scroll position is saved between page submissions. <h:form>
<q:scrollPosition autoSaveScrollPos="true"/>
</h:form>
Specifying Scroll Position on Page LoadYou can specify the position of the scroll on page load by using the int scrollX and scrollY attributes. In these attributes, you should specify the x and y coordinates of the left bottom corner of the currently visible page. <h:form> <q:scrollPosition scrollX="0" scrollY="700"/> </h:form> If the autoSaveScrollPos attribute is set to "true", the scroll position is saved into the scrollX and scrollY attributes between page submissions. Tracking Scroll Position For the Entire ApplicationYou can also set the teamdev.jsf.autoSaveScrollPos context attribute in web.xml to "true" (the default is "false") to track the scroll position for all application pages. <context-param>
<param-name>teamdev.jsf.autoSaveScrollPos</param-name>
<param-value>true</param-value>
</context-param>
|
|
© 2007 TeamDev Ltd. | ![]() |