Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#16279 closed defect (bug) (fixed)

Don't hardcode colspan in WP_List_Table when there are no items

Reported by: garyc40's profile garyc40 Owned by: garyc40's profile garyc40
Milestone: 3.1 Priority: normal
Severity: minor Version: 3.1
Component: Administration Keywords: has-patch
Focuses: Cc:

Description

Currently in WP_List_Table::display_rows_or_placeholder(), when there's no item, colspan = "2" is applied to the no-item cell despite the number of visible columns.

Attachments (2)

garyc40.16279.diff (1.2 KB) - added by garyc40 14 years ago.
don't hardcode colspan
16279.diff (1.3 KB) - added by scribu 14 years ago.
Use get_column_count()

Download all attachments as: .zip

Change History (9)

@garyc40
14 years ago

don't hardcode colspan

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.1

This something we need to address in 3.1? Sounds like it, and I think I've seen evidence of this in the UI with odd wrapping.

#2 @ryan
14 years ago

Looks good.

#3 @nacin
14 years ago

This doesn't take into account hidden columns.

Also, when you do take into account hidden columns with a - count( $hidden ), I get one more, as my array is this: array( 0 => 'response', 1 => '' ). Not a clue why I have the empty value, but an array_filter() can remove it if it isn't just me.

#4 @nacin
14 years ago

Seeing the same thing on other screens. Going to go with array_filter().

#5 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [17339]) Properly account for columns shown in the list table display_rows_or_placeholder methods. props garyc40, fixes #16279.

@scribu
14 years ago

Use get_column_count()

#6 @scribu
14 years ago

  • Keywords needs-testing removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

There's a dedicated method for that: get_column_count(). See 16279.diff.

#7 @nacin
14 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [17342]) Use get_column_count() instead of manual logic. props scribu, fixes #16279.

Note: See TracTickets for help on using tickets.