[Laszlo-user] Selecting a node in a list to populate a form

Matt Raible mraible at gmail.com
Mon Mar 13 22:16:57 EST 2006


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}"
               
onselect="canvas.detailWindow.detailView.datapath.setFromPointer(getSelection())">
                <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 <bbarkley at gmail.com> 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 <mraible at gmail.com> 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}"
>                 onselect="userDp = 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:
>
> onselect="userDp = 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
> Laszlo-user at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>



More information about the Laszlo-user mailing list