I had the same issue when searching a flat view; The search results (when returned results were less than the number of lines displayed) would replace the lines in the existing data and not clear the rest of the view. i.e. if I am showing 15 lines in the view and the search results returned 5 documents, the first five lines of the original view would be replaced with the search results and the other 10 lines would still be document 6-15 of the original documents displayed in the view.
I made the following changes to the jsNotesView2.1.7.js library and now get the proper display (in the flat view I'm using)…
Hope this helps with the final resolution!
====================================
–> in the reset() function I changed the "if(this.view.searchQuery){" statement to:
if(this.view.searchQuery){<br/>
document.getElementById(this.view.id + "-searchcount").childNodes[0].nodeValue = this.view.lang['msg_search_results'].split('$').join(toplevelcount + "");<br/>
this.view.searchResultCount = toplevelcount// For Search View Display Correction<br/>
}<br/>
–> Changed "clearSearch()" to:
this.clearSearch = function(){<br/>
if(this.searchQuery){<br/>
this.changeState("selectedEntryPosition","1");<br/>
this.searchQuery = "";<br/>
this.searchResultCount = "";// For Search View Display Correction<br/>
document.getElementById(this.id + "-searchcount").childNodes[0].nodeValue = "";<br/>
this.reset();<br/>
}<br/>
–> Added the noted lines below to the "drawRows()" function:
if(tbody.rows.length > this.linesToShow + 2){<br/>
var rowToRemove = tbody.rows[tbody.rows.length-1];<br/>
if(rowToRemove.notesViewEntry)rowToRemove.notesViewEntry.tableRow = null;<br/>
tbody.removeChild(rowToRemove);<br/>
}<br/>
// Begin of lines added to resolve Search View Display problem
if(this.searchResultCount!="" && this.searchResultCount > 0){<br/>
if(i==(this.searchResultCount-1)){<br/>
entry=null;<br/>
}<br/>
}<br/>
// End of lines added to resolve Search View Display problem
if(!entry || entry.getMoreChildren || entry.getMoreRows){