[Laszlo-user] Create dataset dynamicly

taocore taocore at laszlomail.com
Tue Sep 4 01:17:11 PDT 2007


For lazy loading, I have to create dataset dynamicly. But I found that 
destroy() method of dataset does not affect the view which use it as 
datapath. Event if after destorying the dataset, I created a new one 
with the same name, it seems that the view still associated with the 
destroyed old dataset. Try the code below on the laszlo explorer online. 
Any sugguestions would be much appreciated.


<canvas debug="true">

   <class name="dset" extends="dataset"

            request="true" type="http"

            src="getemployees.jsp"/>

   <script>

      new dset(canvas, {name:'ds'});

   </script>

   <simplelayout axis="y"/>



   <view name="v" datapath="ds:/phonebook/employee">

     <simplelayout axis="x"/>

     <text datapath="firstName/text()"/>

     <text datapath="lastName/text()"/>

     <text datapath="phone/text()"/>

   </view>


   <view name="bbb" bgcolor="yellow">

     <simplelayout axis="x"/>

     <text datapath="firstName/text()"/>

     <text datapath="lastName/text()"/>

     <text datapath="phone/text()"/>

   </view>


   <button>ok

     <method event="onclick">

        var dp = ds.getPointer();


        dp.selectChild();

        dp.selectChild();

        Debug.write(dp.serialize());

        dp.deleteNode();

        dp.deleteNode();

        ds.abort();

        ds.destroy();



        new dset(canvas, {name:'ds'});

        Debug.write(ds.serialize());

        parent.bbb.setDatapath("ds:/phonebook/employee");

        ds.doRequest();

     </method>

   </button>

</canvas>




taocore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20070904/7d5c8a04/attachment.html


More information about the Laszlo-user mailing list