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&#39;ve tried using AjaxSelectionList with elementName=
=3Dtable but got into some problems.<br><br>The keyselection didn&#39;t wor=
k. after a while of javascript debugging i&#39;ve seen that there was an ex=
tra element &lt;tbody&gt;. 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 &#39;UL&#39; || this.list.nodeN=
ame =3D=3D &#39;OL&#39;) {<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 this.itemType =
=3D &#39;LI&#39;;<br>
=A0=A0=A0 =A0=A0=A0 }<br>=A0=A0=A0 =A0=A0=A0 else if (this.list.nodeName =
=3D=3D &#39;TABLE&#39;) {<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 &#3=
9;TR&#39;;<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=
(&#39;Unknown list node type &quot;&#39; + this.list.nodeName + &#39;&quot;=
.&#39;);<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>&lt;wo:AjaxSelectionList <br>=A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 elementName=3D&quot;table&quot;<br>=
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 class=3D&quot;a=
dressenListe&quot;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 list =3D &quot;$ergebnisAdressen&quot; <br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 item =3D &quot;=
$adresseItem&quot; <br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =
=A0=A0=A0 selection =3D &quot;$selectedAdresse&quot; <br>=A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 focus =3D &quot;$true&quot; <br=
>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 onchange =3D &=
quot;selectAdresse()&quot;<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 onselect =3D &q=
uot;adresseAuswaehlen()&quot; &gt;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 &lt;tr&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=
=A0 =A0=A0=A0 &lt;td&gt;&lt;wo:str value =3D &quot;$adresseItem.name1&quot;=
 /&gt;&lt;/td&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=
=A0=A0 &lt;td&gt;&lt;wo:str value =3D &quot;$adresseItem.name2&quot; /&gt;&=
lt;/td&gt;<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;td&gt;&lt;w=
o:str value =3D &quot;$adresseItem.name3&quot; /&gt;&lt;/td&gt;<br>=A0=A0=
=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;td&gt;&lt;wo:str =
value =3D &quot;$adresseItem.strasse&quot; /&gt;&lt;/td&gt;<br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;td&gt;&lt;wo:str valu=
e =3D &quot;$adresseItem.plz&quot; /&gt;&lt;/td&gt;<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;td&gt;&lt;w=
o:str value =3D &quot;$adresseItem.ort&quot; /&gt;&lt;/td&gt;<br>=A0=A0=A0 =
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;/tr&gt;<br>=A0&lt;/wo:AjaxSelec=
tionList /&gt;<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--