rcyeager
06-06-2006, 12:09 AM
Can anyone provide some guidance as to how to achieve data pooling for my app?
I currently receive XML transactions from a servlet that represent pages of results. I convert the XML string into dataset data, and store these as dataset arrays in my app, to facilitate client-side caching when paging through previously retrieved results.
There aren't many good samples of data pooling. All of them use a single datapath, like this:
<view name="all">
<datapath xpath="phonebook:/contacts/contact" pooling="true"/>
<view>
<simplelayout axis="x"/>
<checkbox width="30" datapath="@checked">
<method event="onvalue">
datapath.updateData()
</method>
<method name="updateData">
return this.value
</method>
<method name="applyData" args="d">
setValue(d)
</method>
</checkbox>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>
</view>
See how a single phonebook dataset is used in the sample? For my app, I need to be able to point to various datasets as result pages are selected.
I tried modifying the datapath directly via script using setXPath() on the datapath to point at my various datasets, but that didn't seem to work. The first page of results rendered OK, but nothing appeared when I tried to change the datapath to the next dataset. My concern with this approach is that it would in some way make pooling nonfunctional. Anyone know?
My Plan B is to create a singleton dataset that the datapath will refer to exclusively, then perform the data swapping into and out of the singleton dataset. My theory being that a singular dataset may be required for pooling. The documentation doesn't spell this out one way or another...
Has anyone tried anything like this? I've looked at the base classes to see how they do pooling, but sample code seems to be lacking in this area.
Robert
I currently receive XML transactions from a servlet that represent pages of results. I convert the XML string into dataset data, and store these as dataset arrays in my app, to facilitate client-side caching when paging through previously retrieved results.
There aren't many good samples of data pooling. All of them use a single datapath, like this:
<view name="all">
<datapath xpath="phonebook:/contacts/contact" pooling="true"/>
<view>
<simplelayout axis="x"/>
<checkbox width="30" datapath="@checked">
<method event="onvalue">
datapath.updateData()
</method>
<method name="updateData">
return this.value
</method>
<method name="applyData" args="d">
setValue(d)
</method>
</checkbox>
<text datapath="@firstName"/>
<text datapath="@lastName"/>
<text datapath="@phone"/>
<text datapath="@email"/>
</view>
</view>
See how a single phonebook dataset is used in the sample? For my app, I need to be able to point to various datasets as result pages are selected.
I tried modifying the datapath directly via script using setXPath() on the datapath to point at my various datasets, but that didn't seem to work. The first page of results rendered OK, but nothing appeared when I tried to change the datapath to the next dataset. My concern with this approach is that it would in some way make pooling nonfunctional. Anyone know?
My Plan B is to create a singleton dataset that the datapath will refer to exclusively, then perform the data swapping into and out of the singleton dataset. My theory being that a singular dataset may be required for pooling. The documentation doesn't spell this out one way or another...
Has anyone tried anything like this? I've looked at the base classes to see how they do pooling, but sample code seems to be lacking in this area.
Robert