Skip to main content
Inspiring
November 28, 2018
Answered

Coldfusion2016 cfgrid rowdblclick listener not firing

  • November 28, 2018
  • 3 replies
  • 642 views

Following this example Easy Rich Internet Applications With ColdFusion 8 — SitePoint  the rowdblclick event does nothing. Same result for the example code and my  augmented code. Neither work. Is there a different way of adding a listener in CF2016?

<script type="text/javascript">

function initGrid(){ 

  var grid = ColdFusion.Grid.getGridObject("aaaGrid");

  grid.on("rowdblclick", showAAAForm);

  }

function showAAAForm(){

    var aaaId = ColdFusion.getElementValue("aaaGrid", "gridForm", "id");

    var url = "aaaForm.cfm?aaaId="+aaaId; 

    ColdFusion.navigate(url, "aaaWin");     

    ColdFusion.Window.show("aaaWin"); 

  }

function submitForm() {  

clearErrors();  

ColdFusion.Ajax.submitForm("aaaForm", "AAA_submit.cfm", submitCallback, errorHandler);  

    }

function submitCallback(response){  

      var errors = ColdFusion.JSON.decode(response);  

      var valid = true;  

        

      for(i in errors){  

    document.getElementById(i+"Error").innerHTML = errors;  

    valid = false;  

      }  

if(valid){  

ColdFusion.Window.hide("aaaWin");  

ColdFusion.Grid.refresh("aaaGrid", true);  

}  

        

  }

function newAAA(){  

var url = "aaaForm.cfm" ;  

ColdFusion.navigate(url, "aaaWin");      

ColdFusion.Window.show("aaaWin");  

}

function errorHandler(code, msg)

    {

        alert("Error!!! " + code + ": " + msg);

    }

   

    function clearErrors(){

    document.getElementById("fNameError").innerHTML = "";

    document.getElementById("lNameError").innerHTML = "";

    }

</script>

    This topic has been closed for replies.
    Correct answer berniemiller

    I found the solution! Replace rowdblclick with itemdblclick

    grid.on("itemdblclick", showAAAForm);

    3 replies

    berniemillerAuthorCorrect answer
    Inspiring
    December 14, 2018

    I found the solution! Replace rowdblclick with itemdblclick

    grid.on("itemdblclick", showAAAForm);

    BKBK
    Community Expert
    December 16, 2018

    Hi berniemiller​, thanks for sharing that. Please mark it as the correct solution. It will help someone else in future.

    Inspiring
    November 28, 2018

    A colleague confirmed it does work with ColdFusion 10 so something has changed in 2016?

    Community Expert
    November 28, 2018

    Who knows? My point is that this stuff is generally unreliable, and if it didn't break in CF 10 (which is no longer supported) it's likely to break in newer versions. I would not be surprised at all if the included JS libraries in CF 2016 or 2018 are newer than the ones included in CF 10.

    Dave Watts, Fig Leaf Software

    Dave Watts, Eidolon LLC
    Community Expert
    November 28, 2018

    You're probably not going to care for my recommendation, but I recommend you avoid using CF's JavaScript UI stuff, especially any examples you see going back to CF 8! JavaScript changes pretty frequently, and JavaScript UI best practices also change frequently, and CF doesn't keep that stuff up to date - I'm not even sure whether they effectively could keep it up to date. Instead, learn JavaScript and JS UI best practices, and write grids etc yourself.

    Dave Watts, Fig Leaf Software

    Dave Watts, Eidolon LLC