title: Angular5 - PrimeNG - p-table component paginator selected tab resets to first tab on data reload
body: <p>PrimeNG, 
  <strong>p-table</strong> component when the data is reloaded the table resets to the first paginator tab.</p>
  
  <p><a href="https://i.stack.imgur.com/OtNZ5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OtNZ5.png" alt="enter image description here"></a></p>
  
  <p>Is there any way to stop that behaviour and make the paginator to remain in the same selected tab (for example 2 or 4 or 5 etc) when the data is reloaded?</p>
  
  <p>I reload the data every 10 seconds by calling the RestAPI using setTimeout() in a loop till it stays on that page.</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>    &lt;p-table #dt [columns]="cols" [value]="dataMarts" [paginator]="true" [rows]="15" [pageLinks]="5" [rowsPerPageOptions]="[5,10,15,20,50,100,200,500,1000]"sortField="Id" resetPageOnSort="false"&gt;
  </code></pre>
  
  <p>Reference: <a href="https://www.primefaces.org/primeng/#/table" rel="nofollow noreferrer">https://www.primefaces.org/primeng/#/table</a></p>
  
  <p>Not sure if this behaviour is something to do with the given explanation in section "<strong>Change Detection</strong>" of the above link.</p>
  
  <p><strong>Update:-</strong> 
  This problem was actually caused by the attribute <strong>sortField="Id"</strong> which caused to always show the first tab. After removing it works fine.</p>