AjaxSelectionList with Table
Tobias Janz <[email protected]> Tue, 7 Jun 2011 14:05:01 +0200
| Newsgroups | gmane.comp.web.webobjects.woproject.devel |
|---|---|
| Message-ID | <[email protected]> |
--001636c92bbb8d6f9e04a51e074f
Content-Type: text/plain; charset=ISO-8859-1
Hi everyone,
i've tried using AjaxSelectionList with elementName=table but got into some
problems.
The keyselection didn't work. after a while of javascript debugging i've
seen that there was an extra element <tbody>. I think firefox did this for
me so i had to change the AjaxSelectionList.js to the following:
initialize: function(id) {
this.container = $(id);
this.list = this.container.down();
if (this.list.nodeName == 'UL' || this.list.nodeName == 'OL') {
this.itemType = 'LI';
}
else if (this.list.nodeName == 'TABLE') {
this.list = this.list.down();
this.itemType = 'TR';
}
else {
var child = this.list.down();
if (child != null) {
this.itemType = child.nodeName;
}
else {
alert('Unknown list node type "' + this.list.nodeName +
'".');
}
}
This is how my WO looks like:
<wo:AjaxSelectionList
elementName="table"
class="adressenListe"
list = "$ergebnisAdressen"
item = "$adresseItem"
selection = "$selectedAdresse"
focus = "$true"
onchange = "selectAdresse()"
onselect = "adresseAuswaehlen()" >
<tr>
<td><wo:str value = "$adresseItem.name1" /></td>
<td><wo:str value = "$adresseItem.name2" /></td>
<td><wo:str value = "$adresseItem.name3" /></td>
<td><wo:str value = "$adresseItem.strasse" /></td>
<td><wo:str value = "$adresseItem.plz" /></td>
<td><wo:str value = "$adresseItem.ort" /></td>
</tr>
</wo:AjaxSelectionList />
I think this is a bad workaround.
Is there a better way to do this?
thanks tobias
--001636c92bbb8d6f9e04a51e074f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hi everyone,<br><br>i've tried using AjaxSelectionList with elementName=
=3Dtable but got into some problems.<br><br>The keyselection didn't wor=
k. after a while of javascript debugging i've seen that there was an ex=
tra element <tbody>. I think firefox did this for me so i had to chan=
ge the AjaxSelectionList.js to the following:<br>
<br>initialize: function(id) {<br>=A0=A0=A0 =A0=A0=A0 this.container =3D $(=
id);<br>=A0=A0=A0 =A0=A0=A0 this.list =3D this.container.down();<br>=A0=A0=
=A0 =A0=A0=A0 if (this.list.nodeName =3D=3D 'UL' || this.list.nodeN=
ame =3D=3D 'OL') {<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 this.itemType =
=3D 'LI';<br>
=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 else if (this.list.nodeName =
=3D=3D 'TABLE') {<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0<span style=3D"co=
lor: rgb(0, 0, 0); background-color: rgb(51, 255, 51);"> this.list =3D this=
.list.down();</span><br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 this.itemType =3D =
9;TR';<br>
=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 else {<br>=A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 var child =3D this.list.down();<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =
if (child !=3D null) {<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 this.item=
Type =3D child.nodeName;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 else {<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 alert=
('Unknown list node type "' + this.list.nodeName + '"=
.');<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 }<br><br>This is how=
my WO looks like:<br><br><wo:AjaxSelectionList <br>=A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 elementName=3D"table"<br>=
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 class=3D"a=
dressenListe"<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 list =3D "$ergebnisAdressen" <br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 item =3D "=
$adresseItem" <br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 selection =3D "$selectedAdresse" <br>=A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 focus =3D "$true" <br=
>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 onchange =3D &=
quot;selectAdresse()"<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 onselect =3D &q=
uot;adresseAuswaehlen()" ><br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 <tr><br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 <td><wo:str value =3D "$adresseItem.name1"=
/></td><br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 <td><wo:str value =3D "$adresseItem.name2" />&=
lt;/td><br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <td><w=
o:str value =3D "$adresseItem.name3" /></td><br>=A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <td><wo:str =
value =3D "$adresseItem.strasse" /></td><br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <td><wo:str valu=
e =3D "$adresseItem.plz" /></td><br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <td><w=
o:str value =3D "$adresseItem.ort" /></td><br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 </tr><br>=A0</wo:AjaxSelec=
tionList /><br><br>I think this is a bad workaround.<br>Is there a bette=
r way to do this?<br>
<br>thanks tobias<br>
--001636c92bbb8d6f9e04a51e074f--