Updated: Comment #N


It has been talked about for some time that the views listing page should have a search field to filter the view listings down. This is not a massive issue right now, as most of us are just using (pretty much) a vanilla D8 installation with (I think) under 10 default views. What about a larger site, with 50 views?

Proposed resolution

Add a search field on the views listing page, similar to that on the module listing, and block listing pages. It would use pretty much the same JS. I also think this should include the name AND description fields in the filtering.

Remaining tasks

Patch, reviews (including a review from at least one of the JS folks), testing.

JS could do with a bit more work - Currently if E.g. there are no disabled views after filtering the table header will still be there. We want to iterate over each table (I think) and if there are no rows after filtering, just hide the the table.

User interface changes

New dynamic search field on views listing page.

API changes


#20 views-list-filter-nojs.patch841 byteststoeckler
PASSED: [[SimpleTest]]: [MySQL] 58,888 pass(es).
[ View ]
#12 2087327-12.patch4.94 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 59,242 pass(es).
[ View ]
#12 interdiff-2087327-12.txt1.18 KBdamiankloip
#7 2087327-7.patch4.84 KBdamiankloip
FAILED: [[SimpleTest]]: [MySQL] 58,964 pass(es), 6 fail(s), and 2 exception(s).
[ View ]
#7 interdiff-2087327-7.txt859 bytesdamiankloip
#6 Views_s56eb3b189537d42.s2.simplytest.me_20130912-161541.png35.85 KBjibran
#6 Views_s56eb3b189537d42.s2.simplytest.me_20130912-161528.png31.45 KBjibran
#4 view-listing-1.png44.49 KBdamiankloip
#4 view-listing-2.png40.27 KBdamiankloip
#1 vdc.views-listing-search.patch4.86 KBdamiankloip
PASSED: [[SimpleTest]]: [MySQL] 59,490 pass(es).
[ View ]


Issue tags:-Needs manual testing
new4.86 KB
PASSED: [[SimpleTest]]: [MySQL] 59,490 pass(es).
[ View ]

Here's an initial patch, it's definitely not perfect but should work ok as a start.

Status:Active» Needs review
Issue tags:+Needs manual testing


We also need screenshots :)

Issue tags:-Needs screenshot, -Needs manual testing, -VDC
new40.27 KB
new44.49 KB

Yep, good plan. Let's do that!

Before filtering:




Issue tags:+Needs manual testing


Here is the screenshot with no result. I think it looks fine but @damiankloip suggested we should also hide the header. So adding the usability tag.



new859 bytes
new4.84 KB
FAILED: [[SimpleTest]]: [MySQL] 58,964 pass(es), 6 fail(s), and 2 exception(s).
[ View ]

Just removed a couple of things from the js file.

Also, spoke to tim.plunkett and he thinks we should leave the tables there even if there are no results. This is the behaviour in the current patch. I think I agree.

Title:Add text search functionality to views listing page[Regression from D7] Add text search functionality to views listing page

Using the regression hammer.

Title:[Regression from D7] Add text search functionality to views listing pageAdd text search functionality to views listing page

+++ b/core/modules/views_ui/js/views_ui.listing.js
@@ -0,0 +1,41 @@
+      var $rowsAndDetails, $rows;

This should be called $rowsAndHeaders.

Additionally, we should mimic the docblocks from the module filtering:

* Filters the module list table by a text input search string.
* Additionally accounts for multiple tables being wrapped in "package" details
* elements.
* Text search input: input.table-filter-text
* Target table:      input.table-filter-text[data-table]
* Source text:       .table-filter-text-source
Drupal.behaviors.tableFilterByText = {

Otherwise this looks great.

Title:Add text search functionality to views listing page[Regression from D7] Add text search functionality to views listing page

The patch looks reasonable ... but I have no clue about JS.

new1.18 KB
new4.94 KB
PASSED: [[SimpleTest]]: [MySQL] 59,242 pass(es).
[ View ]

Made those changes, I didn't add the part about package details, as that's not relevant for us. I also just removed the $rowsAndDetails var, as really we just need $rows.

Status:Needs review» Needs work
Issue tags:-JavaScript, -Needs usability review, -Needs manual testing, -VDC

The last submitted patch, 2087327-12.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+JavaScript, +Needs usability review, +Needs manual testing, +VDC

#12: 2087327-12.patch queued for re-testing.

Issue tags:-Needs manual testing

It works fine in #6 so removing the manual testing tag.

Status:Needs review» Reviewed & tested by the community

Nice work!

Got an agreement with morten, we'll use data- attribute for targetting and selecting elements from JS so that themers can do anything they want to classes while keeping the js working.

So this one +1 but we need a follow-up to change it everywhere in core.

Status:Reviewed & tested by the community» Fixed

Committed and pushed to 8.x. Thanks!


Status:Fixed» Needs review
new841 bytes
PASSED: [[SimpleTest]]: [MySQL] 58,888 pass(es).
[ View ]

I hope I'm not the cause of any rage for re-opening this, but I think I found a valid reason to do do:

Unlike all other JS-filter-thingies in core (modules page, simpletest test page) this one is not hidden if there's no JS, even though it doesn't do anything when JS is disabled. This patch simply copies how the existing two forms do it behavior straight into ViewListController.

Status:Needs review» Reviewed & tested by the community

The best thing about using data attributes for JS is that you can refactor the form api structures without heaving to change the javascript at the same time.

Status:Reviewed & tested by the community» Fixed

Good catch, thanks!

Committed and pushed to 8.x.

Looks great. thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

Updated issue summary.