PDA

View Full Version : Basic Grid Questions: Row number, node data, etc....


pdavie
08-23-2006, 10:14 AM
Hi,
This may be a newbie question, but I'm stuck: The documentation mentions variables that are not accessible with the Debugger and the code examples refer to methods that don't exist!

I have a master list of companies- the datasets connect fine.

Above, I have a detail screen, which the user can enter data into.

My problems are as follows:


How do I find out which row is selected in the grid? options to move next / back but not find current selected row.
How do I see the row dataset as against the whole thing.


For example:


<dataset name="xyz" src="contacts.xml">
<valueList>
<value name="John" phone="9981221"/>
<value name="Sally" phone="9981223"/>
<value name="Faye" phone="9981224"/>
<valueList>
</dataset>


...Other screen code


<tabpane name="tp" datapath="xyz:/valueList/value[1]">
... views, edit boxes etc. that show the values: works OK
</tabpane>


<window name=companyWindow" datapath="xyz:/valueList/value">
<grid ...>
<handler name="onselect">
with (tp.datapath)
{
setXPath('xyz:/valueList/value[' + getNodeOffset() + ']')
}
</handler>


<gridcolumn ... >Name
<statictext datapath="@name"/>
</gridcolumn>
<gridcolumn ... >Phone
<statictext datapath="@phone"/>
</gridcolumn>
</grid>
</window>


I'm using OpenLaszlo 3.3.3 and get a deprecated warning for getNodeOffset and it refers to 'position' which as far as I can tell does not exist, at least from the docs, or the debugger.

What I need to do is set the datapath for "tp" to be the xyz:/valueList/value[x] object where x is the currently selected row.

There is an example in the documentation that shows this, but it uses views not tabpanes and grids and although I have copied the concept it does not work.

I cannot see a way to access valueList/value[x] element. If I have the row number I can set the index, or if I get the relative path within the xpath query, e.g. on row three, get xyz:/valueList/value[3] from somewhere, then I can set the datasource of the tab pane to this and use relative addressing inside the tab pane for the datapath elements.

Suggestions very welcome!
Thanks in advance,
Peter