I am trying to do the client-side pagination using the data table. The pagination works fine, however when i select a row and update the data attribute of lightning datatable with more values than old data attribute values, the selection is not going away.
i selected the first row in above picture. When i changed the row per page from 10 to 15, the first row was still selected although i updated the lightning datatable data attribute with new set of value. 
my lightning datatable look like below.
<lightning-datatable key-field="id" data={data} columns={columns} onrowselection={getSelectedRecord}> </lightning-datatable> Corressponding javascript on rowselection-
getSelectedRecord(event){ this.selectedRows = event.detail.selectedRows; } Record per page Html look like below-
<div class="slds-float_left slds-var-m-around_medium"> <lightning-combobox name="progress" label="Record per page" value={comboboxValue} options={comboboxOption} onchange={handleComboboxChange} ></lightning-combobox> </div> corressponding javascript on value change for combobox-
handleComboboxChange(event){ this.comboboxValue = event.detail.value; this.pageSize = event.detail.value; this.totalPage = Math.ceil(this.totalRecountCount/this.pageSize); this.data = this.items.slice(0,this.pageSize); this.endingRecord = this.pageSize; this.page = 1; this.startingRecord = 1; this.disablePaginationButton(); } 