1

I have a CFGrid which allows editing of data. What I need to do is to validate user inputs via jQuery using some onblur or onchange events. But my jQuery code is unable to access the CFGrid elements using Classes. Here is a code snippet:

<td class=" x-grid-cell x-grid-cell-securityusers_ACTIVE   " id="ext-gen1066"><div class="x-grid-cell-inner " style="text-align: LEFT; ;" id="ext-gen1067">No</div></td>

The above code shows in Firebug when an editable cfgridcolumn is clicked in. So I should be able to use the following:

$('.x-grid-cell-securityusers_ACTIVE').click(function(){            
     alert('click') ;  
});

But this event never fires. I can confirm my jQuery load is fine because a container div (which holds the grid) would generate the click event.

My guess is that CFGRID, being dynamically generated, just doesn't register with JQuery; I have the javascript code also tried under a $(document).ready(function() { but still no event being fired.

Any ideas? Any alternate approach?

Thanks!

IrfanClemson
  • 1,699
  • 6
  • 33
  • 52

1 Answers1

0

Never mind. I think, per comments, the correct approach would have been to study the ExtJS APIs but I didn't have the time for that after some futile tries. So I ended up doing ColdFusion's own validations for the input data after the form post; a bit painful but it works.

IrfanClemson
  • 1,699
  • 6
  • 33
  • 52
  • 1
    Truthfully the UI components like cfgrid are bundled with very outdated versions of the underlying JS libs, and are difficult to customize. IMO the best option is to drop them altogether. Just use whatever JS library you want directly. That way you can use whatever version of the lib you want and not have to worry about things breaking when you update CF. – Leigh May 09 '17 at 15:19
  • 1
    Since you're already using jQuery, I'd recommend https://datatables.net/ – Adrian J. Moreno May 09 '17 at 16:19
  • Thank you both. I have some background in Datatables.net but they were for read-only tabular data and didn't see any 'examples' for ColdFusion for Edits. So, after maybe 12 years, I decided to give the CFGrid another try--only to find out it's so damn hard to configure. Anyway, I got most of the work done; if I knew the limitations of CFGrid, I would have started with jQuery approach. Adobe treats CF as a step child! – IrfanClemson May 09 '17 at 19:10