Bug 12135

Summary: Pending suggestions table width is wrong
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: CirculationAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: chris, gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 12135: Fix suggestions table width
[SIGNED OFF] Bug 12135: Fix suggestions table width
[PASSED QA] Bug 12135: Fix suggestions table width

Description Christopher Brannon 2014-04-24 18:07:01 UTC
It looks like the table for pending suggestions is out of whack.  All the other tabs are formatting to a width of 1006px, but the pending request are formatting the table to a width of 1256px.

Apparently this can't be fixed with jQuery.  I can adjust the widths of the tables on the other tabs, but for some reason it won't work on this particular table.  This is the jQuery I used:

$("#ASKEDt").css("width","1006px");

If I change the ID to one of the other tables, it works just fine.  May be part of the bug.  It looks like it applies, but when you click the tab to look at this table, the old size appears, which makes me think the style is being applied when the tab is clicked, and overridden.  The funny thing is that it doesn't do this with the other tabs.  The jQuery override is applied and sticks, even after changing between the tabs.

Christopher
Comment 1 Owen Leonard 2014-04-24 18:55:27 UTC
There is code in the template which is supposed to fix this which stopped working when we upgraded jQueryUI. The width of tables which are hidden in non-visible tabs cannot be correctly calculated until they are shown--hidden elements have no width. This code fixed it before the jQueryUI upgrade:

    $('#suggestiontabs').tabs({
        // Correct table sizing for tables hidden in tabs
        // http://www.datatables.net/examples/api/tabs_and_scrolling.html
        "show": function(event, ui) {
            var oTable = $('div.dataTables_wrapper>table', ui.panel).dataTable();
            if ( oTable.length > 0 ) {
                oTable.fnAdjustColumnSizing();
            }
        }
    });

The jQueryUI API has changed, so this needs to be corrected on this page and others.
Comment 2 Jonathan Druart 2015-04-27 14:59:43 UTC Comment hidden (obsolete)
Comment 3 Christopher Brannon 2015-04-28 18:50:38 UTC
I think this patch is working.  I definitely see differences.  The problem is that with the table width being dynamic and not fixed to the width of the screen, it is very difficult to tell.
Comment 4 Christopher Brannon 2015-04-28 18:57:01 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2015-04-28 21:16:06 UTC
Created attachment 38617 [details] [review]
[PASSED QA] Bug 12135: Fix suggestions table width

The trick to update the suggestions table width is outdated since jQuery
UI has been updated.

Test plan:
0/ Don't apply this patch
1/ Go on the suggestions page (suggestion/suggestion.pl), change tabs:
the table width is wrong
2/ Apply this patch
4/ Repeat 1 and confirm the width is now updated.

Signed-off-by: Christopher Brannon <cbrannon@cdalibary.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
The table sizes still vary slightly, but this is an improvement.
Comment 6 Jonathan Druart 2015-04-29 07:08:58 UTC
(In reply to Christopher Brannon from comment #3)
> I think this patch is working.  I definitely see differences.  The problem
> is that with the table width being dynamic and not fixed to the width of the
> screen, it is very difficult to tell.

(In reply to Katrin Fischer from comment #5)
> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
> The table sizes still vary slightly, but this is an improvement.

Yes, it's how it is supposed to behave.
Comment 7 Tomás Cohen Arazi 2015-05-06 17:35:21 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 8 Chris Cormack 2015-05-17 06:38:39 UTC
Pushed to 3.18.x will be 3.18.7