What is the best way to clear all the nodes out of a dataset?

I have a view that uses a dataset to dynamicly load images.  The users
sees a Category buttons on the screen.  Clicking on a button should
clear all the nodes from the dataset and re-populate it with the new
nodes for the images in the category that the user clicked on.  If the
category buttons are clicked to fast they just stop working and I
can't figure out why.  It appears as though it's something to do with
how the clearing of the dataset is taking place.

Code:
<library>
  <class name="myView" extends="view" visible="false">
    <event name="category1ButtonClicked" />
    <event name="category2ButtonClicked" />

    <dataset name="categoryImageData"></dataset>

      <button name="category1Button" text="Category 1">
        <handler name="onclick">
          parent.parent.category1ButtonClicked.sendEvent();
        </handler>
      </button>

      <button name="category1Button" text="Category 2">
        <handler name="onclick">
          parent.parent.category2ButtonClicked.sendEvent();
        </handler>
      </button>

      <view name="categoryImagePanel"
datapath="local:classroot.categoryImageData:/*">
        <image datapath="@src" />
      </view>
    </view>

    <method name="clearImagePanel"><![CDATA[
      categoryImageData.childNodes = [];
      ]]>
    </method>

    <method name="addImage" args="imageSrc"><![CDATA[
      var imagePointer = categoryImageData.getPointer();
      imagePointer.addNode("image", null, { src:imageSrc });
      ]]>
    </method>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to