Modify

Opened 3 years ago

Last modified 3 years ago

#9509 assigned defect

with IE9: chart doesn't resize to web page width

Reported by: falkb Owned by: ChrisNelson
Priority: normal Component: TracJsGanttPlugin
Severity: normal Keywords:
Cc: rjollos Trac Release: 0.12

Description

Automatic resizing to page width works with Firefox but the gannt chart has a fixed size of visible 970 pixels using Internet Explorer 9.0.8112.16421.

Attachments (0)

Change History (18)

comment:1 Changed 3 years ago by falkb

uhm... I use latest svn revision of the plugin which is 10855

comment:2 Changed 3 years ago by rjollos

  • Cc rjollos added

comment:3 follow-up: Changed 3 years ago by falkb

more precise: the chart resizes to the window size only on reload of the page displayed in the browser window, but not on just a resize of the browser window.

comment:4 in reply to: ↑ 3 Changed 3 years ago by falkb

Replying to falkb:

more precise: the chart resizes to the window size only on reload of the page displayed in the browser window, but not on just a resize of the browser window.

That's the behaviour with Firefox.

Actual problem: With IE, it doesn't resize on reload of the page either

comment:5 Changed 3 years ago by falkb

The following patch fixes a runtime error where g was not defined and that newline after Draw() prevented from really setting the resize handler.

Now the event handler is really called if you resize the browser window! Resizing is sensibly slower now. Though we just get to the next bug, because calling Draw() in the handler function is not enough. Maybe you have an idea what else has to be called? I suspect DrawDependencies() at least as well...

  • tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py

     
    174174        text += 'var t;\n' 
    175175        text += 'if (window.addEventListener){\n' 
    176176        text += '  window.addEventListener("resize", ' + \ 
    177             'function() { g.Draw();\n }, false);\n' 
     177            'function() { '+self.GanttID+'.Draw(); }, false);\n' 
    178178        text += '} else {\n' 
    179179        text += '  window.attachEvent("onresize", ' + \ 
    180             'function() { g.Draw();\n });\n' 
     180            'function() { '+self.GanttID+'.Draw(); });\n' 
    181181        text += '}\n' 
    182182        return text 

comment:6 Changed 3 years ago by ChrisNelson

(In [11117]) Fix up resize handling. Refs #9509.

I can't test IE behavior easily but this works on FF.

comment:7 Changed 3 years ago by ChrisNelson

  • Status changed from new to assigned

comment:8 follow-ups: Changed 3 years ago by falkb

Cool, FF works pretty well now, reload isn't necessary anymore, resizing the window is enough to make the chart resize. IE still doesn't resize at all and remains with that default size, for both, reload and resize of the browser window. Also after the necessary fix for [11117] (since :

  • tracjsganttplugin/tracjsgantt/tracjsgantt.py

     
    183183            'function() { '+self.GanttID+'.Draw(); ' 
    184184        if options['showdep']: 
    185185            text += self.GanttID+'.DrawDependencies();' 
    186         text += '}, false);\n' 
     186        text += '});\n' 
    187187        text += '}\n' 
    188188        return text 

comment:9 in reply to: ↑ 8 Changed 3 years ago by ChrisNelson

Replying to falkb:

Cool, FF works pretty well now, reload isn't necessary anymore, resizing the window is enough to make the chart resize. IE still doesn't resize at all and remains with that default size, for both, reload and resize of the browser window. Also after the necessary fix for [11117] (since :

  • tracjsganttplugin/tracjsgantt/tracjsgantt.py

     
    183183            'function() { '+self.GanttID+'.Draw(); ' 
    184184        if options['showdep']: 
    185185            text += self.GanttID+'.DrawDependencies();' 
    186         text += '}, false);\n' 
     186        text += '});\n' 
    187187        text += '}\n' 
    188188        return text 

I'm confused. Are you saying that I need to remove the false?

comment:11 Changed 3 years ago by falkb

we need to remove the false but still resizing doesn't work and I don't know why and can't find something on the internet about that :(

comment:12 in reply to: ↑ 8 Changed 3 years ago by falkb

Replying to falkb:

(since

this was just a copy'n'paste mistake

comment:13 Changed 3 years ago by ChrisNelson

(In [11120]) Remove bad argument to attachEvent. Refs #9509.

comment:14 Changed 3 years ago by falkb

I found http://www.codingforums.com/archive/index.php/t-228036.html where people discuss about that resize handler mess with all those different browsers. In the end it seems to me, for getting it work with IE, the resize handler function needs to get some widths from certain inner objects and set the value to the object which is to be resized... too tired for looking through now...

comment:15 follow-up: Changed 3 years ago by falkb

This fixes the chart width in IE for reload and resize, and by using this fix, FF and IE shows equal behaviour now!:

  • tracjsganttplugin/tracjsgantt/htdocs/jsgantt.js

     
    16931693         { 
    16941694         // 95% of overall window width 
    16951695         width = window.innerWidth * 0.95 + 'px'; 
     1696         } else { 
     1697             width = document.documentElement.clientWidth * 0.95 + 'px'; 
    16961698         } 
    16971699 
    16981700     vDiv.style.width = width; 

P.S.: I still see another problem with resize, I mean the vFormat selection always resets to 'day' after you've resized. One must always click the radiobutton to e.g. 'week' again. Somehow changeFormat() or setFormat() is connected with the onclick handler, only. I can see this problem with both browsers, FF and IE. What to do here now?

comment:16 Changed 3 years ago by ChrisNelson

(In [11133]) Handle width in IE. Refs #9509.

comment:17 in reply to: ↑ 15 ; follow-up: Changed 3 years ago by anonymous

Replying to falkb:

P.S.: I still see another problem with resize, I mean the vFormat selection always resets to 'day' after you've resized. One must always click the radiobutton to e.g. 'week' again. Somehow changeFormat() or setFormat() is connected with the onclick handler, only.

This patch fixes it this way:

  • tracjsganttplugin/0.11/tracjsgantt/tracjsgantt.py

     
    177177        text += '  window.addEventListener("resize", ' + \ 
    178178            'function() { ' + self.GanttID+'.Draw(); ' 
    179179        if options['showdep']: 
    180             text += self.GanttID+'.DrawDependencies();' 
     180            text += 'JSGantt.changeFormat("'+defaultFormat+'",'+self.GanttID+');' 
    181181        text += '}, false);\n' 
    182182        text += '} else {\n' 
    183183        text += '  window.attachEvent("onresize", ' + \ 
    184184            'function() { '+self.GanttID+'.Draw(); ' 
    185185        if options['showdep']: 
    186             text += self.GanttID+'.DrawDependencies();' 
     186            text += 'JSGantt.changeFormat("'+defaultFormat+'",'+self.GanttID+');' 
    187187        text += '});\n' 
    188188        text += '}\n' 
    189189        return text 

(Note: changeFormat internally calls DrawDependencies)

If no special radiobutton was clicked before, the chart keeps its format (as set in trac.ini) and doesn't switch to "day" anymore. This should be enough for most of all situations.

=> resolved="fixedforme" :-)

comment:18 in reply to: ↑ 17 Changed 3 years ago by ChrisNelson

Replying to anonymous:

Replying to falkb:

P.S.: I still see another problem with resize, I mean the vFormat selection always resets to 'day' after you've resized. One must always click the radiobutton to e.g. 'week' again. Somehow changeFormat() or setFormat() is connected with the onclick handler, only.

This patch fixes it this way:
...
If no special radiobutton was clicked before, the chart keeps its format (as set in trac.ini) and doesn't switch to "day" anymore. This should be enough for most of all situations.

=> resolved="fixedforme" :-)

Thanks but I really want to remember the format. I have a general idea how to do that that may even work across reloads of the page.

Add Comment

Modify Ticket

Action
as assigned .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.