Issues with composite nested controls in subclassed objects
Background
About a year ago, I needed a calendar widget to use as a date picker. I couldn't find exactly what I wanted so I wrote my own, modelling it on the features I wanted from other ones.
At one point I thought why not write it in the AW framework rather than pure Javascript. Although I didn't have the time to do it then, I revisited this recently.
It took me a little longer than I expected (mainly to get all the CSS rules correct between the 3 browsers I tested against plus dealing with the different style issues between strict and quirks mode).
Design took me a while as I tried various things out before I settled on doing it in a way similar to Carlos' approach (using horizontal panels).
The overall code, however, was much shorter and easier.
I've put the code up as it currently stand here (for strict mode) -
http://www.users.on.net/~asm/calendar/
with the quirks versions here -
http://www.users.on.net/~asm/calendar/quirks.html
I also wrote a custom SQL Date format subclass to support it. The code for that is based on Steve Levithan's date/time format routines, found here -
http://blog.stevenlevithan.com/archives/date-time-format
My date formats are based on Sybase ASE's date styles (I have comments on Steve's page with links to Sybase's docs). The formats can easily be changed/extended to support MS SQL Server. (Not sure about Oracle and other databases though.)
Apart from formatting dates, it can also validate an input date against a specified style.
The Issues
The main problems I have are -
1) No matter what I try, I just can't get the grid cells to refresh when changing the month/year. I've tried every suggestion mentioned in the forum here. The DOM gets updated correctly, just not the displayed HTML.
2) There is a big problem with the IDs of controls/templates. If I use controls, they get unique IDs and work - except when you try to use more than one widget. Then they conflict with each other.
The controls should get their IDs from the parent but they don't. I can't work out why.
If I use templates, their IDs are incomplete. This has been reported before but the suggested solutions don't help.
As it stands, I've put controls in the top horizontal panel and templates in the bottom horizontal panel to illustrate the problems. There are some comments in the code to help identify them.
Similar problems reported in the past were -
http://www.activewidgets.com/javascript.forum.12675.2/input-getting-renamed.html
http://www.activewidgets.com/javascript.forum.13500.5/error-with-button-inside-panel.html
Alex mentions nested controls here -
http://www.activewidgets.com/javascript.forum.17531.4/input-box-in-panel-with.html
but it appears that its still a problem.
This problem is also related -
http://www.activewidgets.com/javascript.forum.8453.2/object-serialization-not-working.html
Any solutions to these 2 problems would be appreciated but I suspect the second one may need to wait for a future version.
Finally, there are a few issues with the AW styles between strict and quirks mode. Strict seems to add left and right padding of 4px to most objects.
I had to write a lot of CSS rules to manage this in strict mode to try and keep both versions looking the same. A side-by-side examination of both shows that the combo and input at the top of the calendar widget aren't laid out exactly the same. IE, in particular, has a problem truncating some text in the combo in quirks mode (just happens with the string "September").
The combo button isn't offset correctly in strict mode with both Google Chrome and IE.
However, the most unusual thing I found was with the grid rows in IE in quirks mode. It appears that the rows aren't offset correctly. I had to add a specific rule to set the top to -1px for IE (see CSS .aw-hpanel-middle rule).
Tooltips in Google Chrome are annoying too. They appear too soon and remain for too long. Any mouse movement over the same element brings the tooltip back. However, this isn't an AW issue and I probably won't leave the tooltips in.
About a year ago, I needed a calendar widget to use as a date picker. I couldn't find exactly what I wanted so I wrote my own, modelling it on the features I wanted from other ones.
At one point I thought why not write it in the AW framework rather than pure Javascript. Although I didn't have the time to do it then, I revisited this recently.
It took me a little longer than I expected (mainly to get all the CSS rules correct between the 3 browsers I tested against plus dealing with the different style issues between strict and quirks mode).
Design took me a while as I tried various things out before I settled on doing it in a way similar to Carlos' approach (using horizontal panels).
The overall code, however, was much shorter and easier.
I've put the code up as it currently stand here (for strict mode) -
http://www.users.on.net/~asm/calendar/
with the quirks versions here -
http://www.users.on.net/~asm/calendar/quirks.html
I also wrote a custom SQL Date format subclass to support it. The code for that is based on Steve Levithan's date/time format routines, found here -
http://blog.stevenlevithan.com/archives/date-time-format
My date formats are based on Sybase ASE's date styles (I have comments on Steve's page with links to Sybase's docs). The formats can easily be changed/extended to support MS SQL Server. (Not sure about Oracle and other databases though.)
Apart from formatting dates, it can also validate an input date against a specified style.
The Issues
The main problems I have are -
1) No matter what I try, I just can't get the grid cells to refresh when changing the month/year. I've tried every suggestion mentioned in the forum here. The DOM gets updated correctly, just not the displayed HTML.
2) There is a big problem with the IDs of controls/templates. If I use controls, they get unique IDs and work - except when you try to use more than one widget. Then they conflict with each other.
The controls should get their IDs from the parent but they don't. I can't work out why.
If I use templates, their IDs are incomplete. This has been reported before but the suggested solutions don't help.
As it stands, I've put controls in the top horizontal panel and templates in the bottom horizontal panel to illustrate the problems. There are some comments in the code to help identify them.
Similar problems reported in the past were -
http://www.activewidgets.com/javascript.forum.12675.2/input-getting-renamed.html
http://www.activewidgets.com/javascript.forum.13500.5/error-with-button-inside-panel.html
Alex mentions nested controls here -
http://www.activewidgets.com/javascript.forum.17531.4/input-box-in-panel-with.html
but it appears that its still a problem.
This problem is also related -
http://www.activewidgets.com/javascript.forum.8453.2/object-serialization-not-working.html
Any solutions to these 2 problems would be appreciated but I suspect the second one may need to wait for a future version.
Finally, there are a few issues with the AW styles between strict and quirks mode. Strict seems to add left and right padding of 4px to most objects.
I had to write a lot of CSS rules to manage this in strict mode to try and keep both versions looking the same. A side-by-side examination of both shows that the combo and input at the top of the calendar widget aren't laid out exactly the same. IE, in particular, has a problem truncating some text in the combo in quirks mode (just happens with the string "September").
The combo button isn't offset correctly in strict mode with both Google Chrome and IE.
However, the most unusual thing I found was with the grid rows in IE in quirks mode. It appears that the rows aren't offset correctly. I had to add a specific rule to set the top to -1px for IE (see CSS .aw-hpanel-middle rule).
Tooltips in Google Chrome are annoying too. They appear too soon and remain for too long. Any mouse movement over the same element brings the tooltip back. However, this isn't an AW issue and I probably won't leave the tooltips in.
Anthony
September 24,