:: Forum >>

Both Single And Double-Click Actions On Cell

All:

Is it possible to have a cell scripted to have actions on both single- and double-clicks?Seems like I can't get a double-click event fired off when I use both:

obj.onCellClicked = function(event, column, row) {
    switch (parseInt(column)) {
        case colExp:
            myExpRows[row] = ( (myExpRows[row] == 1) ? 0 : 1);
            var visArray = toggleExpandCollapse();
            if (visArray.length > 0) {
                obj.setRowCount(visArray.length);
                obj.setRowIndices(visArray);
            }
            break
        case colAccount:
            popUpVndActNb( column, row );
            break;
        case colVendor:
            popUpVendorName( column, row );
            break;
        case colContract:
            popUpVndCntNb( column, row );
            break;
        case colSched:
            popUpSchedule( column, row );
            break;
    }
    
};

obj.onCellDoubleClicked = function(event, column, row) {
    switch (parseInt(column)) {
        case colVendor:
            window.open("displayVendor.asp?PID=" + obj.getCellValue( colVID, row ), "Vendor");
        break;
        case colContract:
            window.open("viewVendorContractDetails.asp?VndCntID=" & cntid & "&PID=" + obj.getCellValue( colVID, row ) );
        break;
    }
};
Paul Tiseo
Thursday, December 14, 2006
Alex kindly reminded me that this is not just an AW problem, but a more general onclick/ondblclick problem.

The solution? You need to put the response to a single-click on a timer to allow a read in the double-click. For example, for the vendor column, I want a popup on a cell's single-click and a second window opened on a cell's double-click. Thus:

case colVendor:
timer = setTimeout("popUpVendorName(" + column + "," + row + ")", 500); // timer to allow read for double-click
break;


and

case colVendor:
window.clearTimeout(timer); // cancel timer if one was started
window.open("displayVendor.asp?PID=" + vid, "Vendor");
break;
Paul Tiseo
Friday, December 15, 2006

This topic is archived.


Back to support forum

Forum search