Fix the Edit Columns button after updating a datagrid.

Review Request #8382 — Created Sept. 5, 2016 and submitted

Information

Djblets
release-0.9.x
795032e...

Reviewers

The Edit Columns button on datagrids was breaking after reordering
columns, and likely after other operations that would result in datagrid
state being reloaded. This was due to the Edit Columns element
disappearing, and the event handler being invalidated as a result (as it
was only set up after handling mobile mode changes, or when initially
creating the datagrid).

We now attach the event handler higher up, allowing the event to bubble,
so we don't have to micromanage it. We also reload the ID both when
rebuilding the header for a mobile mode change and when building the
header after reload of datagrid contents.

Checked the button after loading the datagrid, and saw the menu appear.

Reordered columns (as per the repro case) and checked the button again.
It worked.

Went into mobile mode (by resizing the window), and checked. Still worked.

Went out of mobile mode, and checked once more. Worked again.

Repeated these tests but with adding columns.

Description From Last Updated

Maybe call this editButtonID instead?

daviddavid
reviewbot
  1. Tool: Pyflakes
    Ignored Files:
        djblets/static/djblets/js/datagrid.js
    
    
    
    Tool: PEP8 Style Checker
    Ignored Files:
        djblets/static/djblets/js/datagrid.js
    
    
  2. 
      
david
  1. 
      
  2. djblets/static/djblets/js/datagrid.js (Diff revision 1)
     
     
    Show all issues

    Maybe call this editButtonID instead?

    1. It's the selector, though. The ID would be without the #.

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-0.9.x (923bbf3)