The following error occurs when I uncheck the default table format settings of "Add views row classes", "Add striping (odd/even), first/last row classes", and "Override normal sorting if click sorting is used". The error is gone if I check the three options as default again.

Notice: Undefined variable: row_classes in include() (line 38 of C:\wamp\www\sites\all\modules\views\theme\views-view-table.tpl.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
416 bytes

Here is a small patch which should fix that issue.

DrupalDan’s picture

thank for the patch dawehner. Yes, it works and everything seems pretty good.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Yet Another Undefined Index Error

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for testing the patch!

Committed to 7.x-3.x and 8.x-3.x

Status: Fixed » Closed (fixed)

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

Boobaa’s picture

Version: 7.x-3.x-dev » 7.x-3.5
Status: Closed (fixed) » Needs work

Seems like it's not enough; I am running into the same error if I have "Add views row classes" ON, "Add striping (odd/even), first/last row classes" OFF, "Override normal sorting if click sorting is used" OFF, the view has no results, but the view does have a message to be displayed IN the table if there is no result. In this case it seems like that while there are no (result) rows in template_preprocess_views_view_table() (so $vars['rows_classes'] will NOT be set), there ARE (table) rows to be displayed, so we are running into the error because there's no $rows_classes variable set.

I must admit that one can get rid of the error message by enabling "Add striping (odd/even), first/last row classes", but that's only masking the problem.

Olarin’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
602 bytes

This patch is slightly careless as it will inadvertently remove "views-row-first" and "views-row-last" from the empty table row if they were otherwise being set, but perhaps this is desirable as it's not really a normal row anyway?

Status: Needs review » Needs work

The last submitted patch, 7: views-undefined_row_classes_on_empty_table-1597002-7.patch, failed testing.

Olarin’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: views-undefined_row_classes_on_empty_table-1597002-7.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: views-undefined_row_classes_on_empty_table-1597002-7.patch, failed testing.

Olarin’s picture

Version: 7.x-3.5 » 7.x-3.8
Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 7: views-undefined_row_classes_on_empty_table-1597002-7.patch, failed testing.