Issues with composite nested controls in subclassed objects
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.
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) -
with the quirks versions here -
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 -
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 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 -
Alex mentions nested controls here -
but it appears that its still a problem.
This problem is also related -
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.