I have a scrollable dataTable with 100+ records when I add a new record (outside the default scope) and update the data that the dataTable is loading from record 0, whereas I need to have the data view in the previous position.
My dataTable code
<p:dataTable id="DataTable" value="#{dtMB.selectDataModel}" var="test" scrollable="TRUE" scrollHeight="500" styleClass="day-column2" selectionMode="single" >
<ui:insert name="TableInsert" >
<ui:include src="test.xhtml" />
</ui:insert>
</p:dataTable>
Command button (inside the dialog) that updates the datatable
<p:commandButton id="saveNew" value="Save" type="submit" process="@parent" onsuccess="addNew.hide()" action="#{dtMB.addNew()}" update=":FORM:usrMsg :FORM:TABView:DataTable"/>
Currently I need to scroll back to the nth record to see what has been added or any updates, etc. Is there any option in the primary datatable, or do I need to write javascript for the same.
source
share