Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Coldfusion2016 cfgrid rowdblclick listener not firing

Explorer ,
Nov 28, 2018 Nov 28, 2018

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>

544
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Dec 14, 2018 Dec 14, 2018

I found the solution! Replace rowdblclick with itemdblclick

grid.on("itemdblclick", showAAAForm);

Translate
Community Expert ,
Nov 28, 2018 Nov 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 28, 2018 Nov 28, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 28, 2018 Nov 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2018 Dec 14, 2018

I found the solution! Replace rowdblclick with itemdblclick

grid.on("itemdblclick", showAAAForm);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2018 Dec 16, 2018
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources