Fix the Edit Columns button after updating a datagrid.
Review Request #8382 — Created Sept. 5, 2016 and submitted — Latest diff uploaded
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.