|
The dblclick doesn't fire for the grid or grid row. IT REALLY SHOULD. I got this code from a guy on one of the Laszlo forums and tweaked it a bit. I forget his name, so credit goes to him whoever he is: <?xml version="1.0" standalone="no"?> <!DOCTYPE canvas SYSTEM "http://www.laszlosystems.com/lps/tools/lzx.dtd"> <library> <include href="" /> <include href=""/> <class name="dcGrid" extends="grid"> <attribute name="lastSelectionTime" value="0"/> <attribute name="lastSelectedRow" value="-1"/> <attribute name="onRowDoubleClicked" value="null"/> <method name="itemSelected" args="item" event="onselect"> <![CDATA[ var selectionTime = (new Date).getTime() ; var currentRow = this.getIndexForItem(item) ; //Debug.write( "dcGrid::itemSelected: item: " + item ) ; //Debug.write( "dcGrid::itemSelected: currentRow: " + currentRow ) ; if ( (selectionTime - this.lastSelectionTime) <= 500 // adjust this as desired... && currentRow == lastSelectedRow ) { if(this.onRowDoubleClicked) this.onRowDoubleClicked.sendEvent(item) ; } this.lastSelectedRow = currentRow ; this.lastSelectionTime = selectionTime ; ]]> </method> </class> </library> Here is a sample to list some users: ======================= <dcGrid name="userGrid" datapath="local:classroot.getUsersDS:/Users" contentdatapath="User" width="40%" height="100%" showhscroll="true" bgcolor="0xCAE1FF" > <method event="onRowDoubleClicked" args="selectedRow"> parent.viewingIndex = this.getIndexForItem(selectedRow) ; // Debug.write('grid::onRowDoubleClicked: viewing index in ' + parent.name + ": " + parent.viewingIndex + " (" + this.lastSelectedRow + ")" ); // Find the id of the selected row var useridId = selectedRow.datapath.xpathQuery( "UserId/text()" ) ; // Debug.write( "grid::onRowDoubleClicked: selectedRow.datapath: (" + selectedRow.datapath.class.name + ") " + selectedRow.datapath.serialize() ) ; Debug.write( "grid::onRowDoubleClicked: selected user Id is " + userId ) ; if ( userId.length > 0 ) { // Do whatever you want at this point; you have a valid user Id.... } </method> <gridcolumn width="${parent.width /2 }">Last Name <text datapath="LastName/text()"/> </gridcolumn> <gridcolumn width="${parent.width /2 }">First Name <text datapath="FirstName/text()"/> </gridcolumn> </dcGrid> Here's some sample XML ======================= <Users> <User> <UserId>1</UserId> <FirstName>Donald</FirstName> <LastName>Duck</LastName> <Address1>1332 Fox Run</Address1> <Address2/> <City>Disneyland</City> <State>Confusion</State> <Zip>73003</Zip> <Country>USA</Country> <Phone1>405-123-4567</Phone1> <Phone2>405-780-3433</Phone2> <EmailAddress>[EMAIL PROTECTED]</EmailAddress> </User> </Users> ======================= Luca Ritossa wrote:
|
_______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
