Andrews
Andrews

Reputation: 985

Clearing dataset takes lot of time in Openlaszlo

I have a dataset defined as below:

<dataset name="MyComboDset" request="false" src="http:servlet/myTestServlet" 
type="http" ondata="Debug.write('reloaded data for combo');" />

I use it to populate a custom combobox:

<class name="mycombo" extends="combobox" editable="false"
    width="130" autoscrollbar="true" shownitems="20" >
    <attribute name="where" type="string" value="true" />
    <textlistitem
        datapath="MyComboDset:/mynode1/mynode2/mynode3/"
        text="$path{'@name'}" value="$path{'@type'}" name="andytxtlstitem" >
        <method event="ondata">
            <![CDATA[

        var txt = this.datapath.xpathQuery("@name");
        if(txt=="Dummy")
        {
            parent.removeItem(txt);
        }           
        parent.selectItemAt(0);
        ]]>
        </method>
    </textlistitem>
</class>

I am submitting the form manually.

Now, When I have the same code running separately it takes much lesser time to repopulate, almost instantaneously.

But, when I have the code running from within our application, it takes 12 seconds to repopulate if the number of items in list is 25.

I have tried replacing the my custom combobox with datacombobox and it seems to repopulate instantaneously.

After various checking found that clearing the data in dataset takes time. If I execute the following code in Evaluator:

Debug.write("start :"+(new Date()).getTime());canvas.uiattrrules.setData([]);Debug.write("end :"+(new Date()).getTime());

It takes the same 12 seconds after which if I repopulate the combobox, it happens much faster.

What is going on here? How are dataset values repopulated? Suggest any change to make it faster.

Upvotes: 1

Views: 103

Answers (0)

Related Questions