jQuery functionality not working on rendered form fields in Datatable
jQuery functionality not working on rendered form fields in Datatable
Hello folks!
Been using Datatables in many applications and so far it's worked like a charm. But I've hit a snag when form fields are inserted using 'fnrender'.
As per my understanding, 'fnrender' returns a string instead of the actual DOM object. Fair enough. So I tried something different.
Due to company policy I cannot share my code but I can explain my workflow.
1. Datatable is first initialized. As expected, no data is available for view.
2. I called an external ajax on page load that returns the a json data. (ex. $.ajax({...some code here...}))
3. The json is parsed and 'fnAddData()' is called to insert the records into the datatable. (the method is called in $.ajax() 'success' function)
The first column has only checkboxes. The data appears fine. However, any kind of jquery functionality on the checkbox fails such as 'click' or 'hover'. I can serialize the data on submit button but I can't do anything with the form fields themselves.
In short, I can't perform any validation on form fields in a Datatable no matter how I try.
Is there absolutely any way that I can perform jQuery related functions on Datatable form fields?
Thanks for any kind of help.
Regards,
Sabier
Been using Datatables in many applications and so far it's worked like a charm. But I've hit a snag when form fields are inserted using 'fnrender'.
As per my understanding, 'fnrender' returns a string instead of the actual DOM object. Fair enough. So I tried something different.
Due to company policy I cannot share my code but I can explain my workflow.
1. Datatable is first initialized. As expected, no data is available for view.
2. I called an external ajax on page load that returns the a json data. (ex. $.ajax({...some code here...}))
3. The json is parsed and 'fnAddData()' is called to insert the records into the datatable. (the method is called in $.ajax() 'success' function)
The first column has only checkboxes. The data appears fine. However, any kind of jquery functionality on the checkbox fails such as 'click' or 'hover'. I can serialize the data on submit button but I can't do anything with the form fields themselves.
In short, I can't perform any validation on form fields in a Datatable no matter how I try.
Is there absolutely any way that I can perform jQuery related functions on Datatable form fields?
Thanks for any kind of help.
Regards,
Sabier
This discussion has been closed.