I localized an application that normally uses remote data. The code  
is below:

<canvas width="100%" height="100%" debug="true">
   <class name="mytest" extends="window">
     <attribute name="resultsgrid" value="null" />
     <attribute name="resultsmsgs" value="null" />

     <dataset name="dset">
       <rsp stat="ok">
         <messages>
           <message image="error.png" code="404"/>
           <message image="error.png" code="405"/>
         </messages>
         <countries total="238" perpage="25" page="1" count="25"  
pages="10">
           <country active="1" code="AF" name="AFGHANISTAN" id="1"/>
           <country active="1" code="AX" name="ALAND ISLANDS" id="2"/>
           <country active="1" code="DZ" name="ALGERIA" id="4"/>
           <country active="1" code="AS" name="AMERICAN SAMOA" id="5"/>
           <country active="1" code="AO" name="ANGOLA" id="7"/>
           <country active="1" code="AI" name="ANGUILLA" id="8"/>
           <country active="1" code="AQ" name="ANTARCTICA" id="9"/>
           <country active="1" code="AG" name="ANTIGUA AND BARBUDA"  
id="10"/>
           <country active="1" code="AR" name="ARGENTINA" id="11"/>
           <country active="1" code="AM" name="ARMENIA" id="12"/>
           <country active="1" code="AW" name="ARUBA" id="13"/>
           <country active="1" code="AU" name="AUSTRALIA" id="14"/>
           <country active="1" code="AT" name="AUSTRIA" id="15"/>
           <country active="1" code="AZ" name="AZERBAIJAN" id="16"/>
           <country active="1" code="BS" name="BAHAMAS" id="17"/>
           <country active="1" code="BH" name="BAHRAIN" id="18"/>
           <country active="1" code="BD" name="BANGLADESH" id="19"/>
           <country active="1" code="BB" name="BARBADOS" id="20"/>
           <country active="1" code="BY" name="BELARUS" id="21"/>
           <country active="1" code="BE" name="BELGIUM" id="22"/>
           <country active="1" code="BZ" name="BELIZE" id="23"/>
           <country active="1" code="BJ" name="BENIN" id="24"/>
           <country active="1" code="BM" name="BERMUDA" id="25"/>
           <country active="1" code="BT" name="BHUTAN" id="26"/>
           <country active="1" code="BO" name="BOLIVIA" id="27"/>
         </countries>
       </rsp>
     </dataset>

     <datapointer name="messagesdp">
       <handler name="ondata" args="d">
         <![CDATA[
             if ( classroot.resultsmsgs ) {
               classroot.resultsmsgs.setVisible( true );
               classroot.resultsmsgs.setDatapath 
( "local:classroot.dset:/rsp/messages/message" );
             }
         ]]>
       </handler>
     </datapointer>

     <datapointer name="countriesdp">
       <handler name="ondata" args="d">
         <![CDATA[
             if ( classroot.resultsgrid ) {
               classroot.resultsgrid.setVisible( true );
               classroot.resultsgrid.setDatapath 
( "local:classroot.dset:/rsp/countries" );
             }
         ]]>
       </handler>
     </datapointer>

     <method name="hideresults">
       <![CDATA[
           if ( resultsmsgs ) resultsmsgs.setVisible( false );
           if ( resultsgrid ) resultsgrid.setVisible( false );
       ]]>
     </method>

     <method name="search">
       <![CDATA[
           hideresults;
           //dset.doRequest();
           messagesdp.setXPath( "local:dset:/[EMAIL PROTECTED] = 'ok']/ 
messages" );
           countriesdp.setXPath( "local:dset:/[EMAIL PROTECTED] = 'ok']/ 
countries" );
       ]]>
     </method>

     <simplelayout axis="y" spacing="5" />

     <button name="submit" onclick="classroot.search();">Fetch</button>

     <view name="window" width="${immediateparent.width}">
       <simplelayout axis="y" spacing="5" />

       <view name="_messages"
             visible="false"
             width="${parent.width}">

         <method name="init">
           <![CDATA[
              super.init();
              classroot.resultsmsgs = this;
           ]]>
         </method>

         <handler name="ondata" args="d">
           <![CDATA[
              this.setVisible(true);
           ]]>
         </handler>

         <datapath />
         <simplelayout axis="x" spacing="5" />

         <text resize="true" datapath="@code" />
       </view>

       <grid name="_grid"
             visible="false"
             width="${parent.width}">

         <method name="init">
           <![CDATA[
              super.init();
              classroot.resultsgrid = this;
           ]]>
         </method>

         <datapath replication="lazy" />

         <gridtext width="30" editable="false" sortable="false"  
datapath="position()">#</gridtext>
         <gridtext width="40" editable="false" datapath="@code">Code</ 
gridtext>
         <gridtext width="280" editable="false"  
datapath="@name">Name</gridtext>
       </grid>
     </view>
   </class>

   <mytest name="mytest1" width="500" height="400" />
</canvas>

The problem I have is that when I click on Fetch, the "messages" are  
displayed underneath the grid and I want them displayed before the  
grid. Logically, it is defined before the grid. Why is it displayed  
after it?

Thanks,
Daniel

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to