I'm trying to get tabs created dynamically from dynamically bound data.
In the simple example below, I'd like the tab to be instantiated on a button
click
which constructs the xml which in turn should set the tab heading (and much
else
in my application) based on the value provided in the xml.

I must be missing something really simple about databinding, but the ondata
seems
to be getting nulls from @name.

Any help would be much appreciated.

-shishir


<canvas debug="true" height="50%" width="100%">

<dataset name="mydata">
<tabs>
</tabs>
</dataset>

<view height="50%" width="100%">
<button datapath="mydata:/tabs">Add to dataset
<method event="onclick">
var dp = canvas.datasets.mydata.getPointer();
dp.setXPath('tabs');
dp.addNode('tab', 'Tab 1 text', { name: 'tab1'});
dp.setXPath('tab');
// Write out the contents of the dataset for debugging
Debug.write( canvas.datasets.mydata.getPointer().serialize() );
</method>
</button>

<tabs id="definitions" y="50" width="100%" height="50%"
datapath="mydata:/tabs">

<tabpane datapath="tab" text="New Tab" >
<handler name="ondata">
var word = datapath.xpathQuery('@name/text()');
Debug.write('ondata- setting name to - ' + word);
this.setAttribute('text', word);
</handler>
</tabpane>
</tabs>
</view>
</canvas>

Reply via email to