Nuts. For some reason it looks like the datapointer returned by getSelection() isn't worthy of being used to set the value for a datapath. In the debugger it looks like it's xpath value is set to null, maybe that's why...?

You can use the datapath from the selected row itself though. Below is an example.

Laszlo folks: why doesn't the commented out line below work?

<canvas height="100%" width="100%"  bgcolor="0x666666" debug="true">  
    <dataset name="userDS">
        <users>
            <user>
                <fname>Bob</fname>
                <lname>Smith</lname>
            </user>
            <user>
                <fname>Paul</fname>
                <lname>Jones</lname>
            </user>
            <user>
                <fname>Mike</fname>
                <lname>Johnson</lname>
            </user>
        </users>
    </dataset>
   
    <view layout="axis:y; spacing:10">
        <grid datapath="userDS:/users">
            <method event="onselect" args="selRow">
                // below doesn't work - why?
                // parent.userView.datapath.setFromPointer(getSelection());
                parent.userView.datapath.setFromPointer(selRow.datapath);
            </method>
            <gridtext datapath="fname/text()" editable="false">First Name</gridtext>
            <gridtext datapath="lname/text()" editable="false">Last Name</gridtext>
        </grid>
         
        <view name="userView" height="50" width="150" bgcolor="blue" layout="axis:y; spacing:5" datapath="">
            <text datapath="fname/text()" resize="true"/>
            <text datapath="lname/text()" resize="true"/>
        </view>
    </view>
</canvas>

On 3/13/06, Matt Raible <[EMAIL PROTECTED]> wrote:
Is it possible to get an XPath _expression_ from getSelection()?  I've
removed "user" from the name of my windows and views, and tried all of
the following calls - and none of them work:

lzx> canvas.detailWindow.detailView.datapath.setPointer (canvas.listWindow.listView.data.getSelection());
lzx> canvas.detailWindow.detailView.datapath.setFromPointer(canvas.listWindow.listView.data.getSelection());
lzx> canvas.detailWindow.detailView.datapath.setPointer (canvas.listWindow.listView.data.getSelection());
lzx> canvas.detailWindow.detailView.datapath.setNodes(canvas.listWindow.listView.data.getSelection());
lzx> canvas.detailWindow.detailView.setDatapath(canvas.listWindow.listView.data.getSelection ());
lzx> canvas.detailWindow.detailView.datapath.setXPath(canvas.listWindow.listView.data.getSelection());
lzx> canvas.detailWindow.detailView.setDatapath(canvas.listWindow.listView.data.getSelection().getDatapath());

    <window name="listWindow" title="Users" x="20" y="60" width="400"
height="250" resizable="true"
        visible="true" closeable="true">
        <view name="listView" width="${immediateparent.width}"
height="${immediateparent.height}" bgcolor="silver" layout="axis: y">
            <grid name="data" datapath="userDset:/"
width="${immediateparent.width}" height="${immediateparent.height}"

>                <gridtext datapath="id/text()" width="50"
editable="false">Id</gridtext>
                <gridtext datapath="firstName/text()" width="100"
editable="false">First Name</gridtext>
                <gridtext datapath="lastName/text()" width="100">Last
Name</gridtext>
                <gridtext datapath="birthday/text()" width="80"
editable="false">Birthday</gridtext>
            </grid>
        </view>
    </window>

    <window name="detailWindow" title="User Details" x="70" y="300"
width="350" height="200" resizable="true"
        visible="true" closeable="true">
        <view name="detailView" width="${immediateparent.width}"
height="${immediateparent.height}"
            layout="axis: y">
            <text name="id" visible="false" datapath="id/text()"/>
            <text y="10">First Name:</text>
            <edittext name="firstName" datapath="firstName/text()"
x="80" y="10"/>
            <text y="35">Last Name:</text>
            <edittext name="lastName" datapath="lastName/text()" x="80" y="35"/>
        </view>
    </window>

Thanks,

Matt

On 3/13/06, Bryan Barkley < [EMAIL PROTECTED]> wrote:
> I believe the datapath attribute must be an xpath _expression_ into a dataset,
> not a reference to a datapointer. In your onselect you may want to try
> something along the lines of
> canvas.userDetailsWindow.datapath.setFromPointer
> (getSelection()).
>
>   - Bryan
>
>
> On 3/11/06, Matt Raible < [EMAIL PROTECTED]> wrote:
> >
>  I have a grid that I'm using to display a bunch of users:
>
>     <dataset name="userDset"/>
>     <datapointer id="userDp"/>
>
>             <grid datapath="userDset:/"
> width="${immediateparent.width}" height="${immediateparent.height}"
>                 = getSelection();
> canvas.userdetailsWindow.setVisible(true)">
>                 <gridtext datapath="id/text()" width="100"
> editable="false">Id</gridtext>
>                 <gridtext datapath="firstName/text()" width="100"
> editable="false">First Name</gridtext>
>                 <gridtext datapath="lastName/text()" width="100"
> editable="false">Last Name</gridtext>
>                 <gridtext datapath="birthday/text()" width="80"
> editable="false">Birthday</gridtext>
>             </grid>
>
> When a user clicks on the row, I want to popup a form that contains
> editable fields.  I believe the following should properly indicate
> which record to edit:
>
> = getSelection();
> canvas.userdetailsWindow.setVisible (true)">
>
> However, I don't know what to set my form view's datapath to.  I've
> tried "userDp:/item" and userDp:/*, but it doesn't work:
>
>         <view name="userdetailsView" width="${ immediateparent.width}"
> height="${immediateparent.height}"
>             layout="axis: y" datapath="userDp:/item">
>             <text name="id" visible="false" datapath="id/text()"/>
>             <text y="10">First Name:</text>
>             <edittext name="firstName" datapath="firstName/text()"
> x="80" y="10"/>
>             <text y="35">Last Name:</text>
>             <edittext name="lastName" datapath="lastName/text()" x="80"
> y="35"/>
>         </view>
>
> Any help is appreciated.
>
> Matt
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to