• RestrictToCategory and Search

    By Paul S Withers 1 decade ago

    I had some problems with users wanting to search in a restrictToCateory view. The problems were two-fold:

    1) Search returns all documents matching criteria, not just the ones from the current category.

    2) Search draws columns including the category column, so everything gets shifted one column to the right.



    To get round the second problem, I hide my category column and amend line 453 so the offset is always 0.



    The first problem was more complex, so I add this.restrictSearch="" as another property for the NotesView2 function. I then modify line 595 to read "this.searchQuery = query + this.restrictSearch".



    In views where I do a restrictToCategory, I also add restrictSearch, using normal Notes search terminology (prefaced with a space, because we're not adding one after query), so e.g.

    this.restrictSearch = " AND FIELD CompanyCode = " + form.CompanyCode.value;



    I should have posted this sooner, but just got round to it.