On 18 feb 2010, at 20:30, Anjo Krank wrote:
> The nicest would the to move the JS to a behaviour, based on an attribute:
>
>>>> YourLink : WOHyperlink {
>>>> imageID = sess.selectedPerformance.primaryKey;
>>>> }
>
>
Based on this idea I ended up with this solution:
<wo:WOHyperlink href='javascript:ShowContent(this)'
onMouseOver='ShowContent(this)' onMouseOut='HideContent(this)' divID="Image"
elementID="[mySess.selectedPerformance.primaryKey]">
<wo:WOGenericContainer elementName = "[bigPictureDivIDNoStyle]" style =
"display:none; position: absolute; border-style: solid; background-color:
#b53f1d; padding: 5px; width: 200px">
<img src="[mySess.selectedPerformanceImageBig]" border="0"/>
</wo:WOGenericContainer>
The javascript code
to display this stuff then ends up with:
function ShowContent(d) {
if(d.length < 1) {
return;
}
var dd =
document.getElementById(d.getAttribute("divID")+d.getAttribute("elementID"));
AssignPosition(dd);
dd.style.display = "block";
}
So depending on the elementID and the divID the content is shown. A very nice
solution, that makes sure all the javascript code is in javascript and the css
en html is in the WO.
There only lingering problem is the div id that is now generated with java
code as this;
public String bigPictureDivIDNoStyle(){
return "div
id=\"Image"+mySess().selectedPerformance().primaryKey()+"\"";
}
Mike suggested to use OGNL style, so something like
<wo:WOGenericContainer elementName = "~\"div id=Image\" +
mySess.selectedPerformance.primaryKey + \"\"" style = "display:block; position:
absolute; border-style: solid; background-color: #b53f1d; padding: 5px; width:
200px">
would put all the div identification in the HTML code and not in the java code.
Problem is that I am using the WO54 parser, with the
"[mySess.selectedPerformance.primaryKey]" inline notation. I can not seem to
find a way to enable the WOOGNL framework without blowing up that coding style,
they do not seem to be compatible. Or is there a way to get them compatible?
> {
> "LI.images A": function(e) {
> e.onmouseup = function()...
> }
> }
>
> Cheers, Anjo
>
>
>
> Am 18.02.2010 um 20:18 schrieb Mike Schrag:
>
>>>> YourLink : WOHyperlink {
>>>> href = ~'javascript:ShowContent(' + sess.selectedPerformance.primaryKey
>>>> + ')';
>>>> }
>>> And handle the "Image" + pk in the JS method? Also, you could:
>> Whoops -- typo, though that's an option, too.
>>
>>>> YourLink : WOHyperlink {
>>>> href = ~'javascript:ShowContent(this)';
>>> imageID = sess.selectedPerformance.primaryKey;
>>>>
>>>> }
>>> And handle that in the JS by "Image" + e.getAttribute("imageID")
>> this might be the nicest suggestion so far ...
>>
>> ms
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/johan%40netsense.nl
>
> This email sent to [email protected]
Johan Henselmans
[email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]