Datatables and jQuery "on" method -


I am trying to create a dynamic table, which is clicked as a row, and more More information should be displayed.

I'm doing this based on a few codes written a year ago, where I used the jQuery Live method. As of now, this method is no longer present and I am switching to the method.

Now, the problem is, while this code actually triggers the creation of the datator, the click event will not bind the line when I click on it, nothing happens.

This is a responsible JavaScript code:

  & lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {$ ( "# Overview") DataTable ({aoColumnDefs :. [{SWidth: "20px", aTargets: [0]}], bLengthChange: false, oLanguage: {sProcessing: " Bitte Warten ... ", sLengthMenu:" _MENU_ Einträge anzeigen ", sZeroRecords:" Keine Einträge vorhanden ", sInfo:". _START_ bis _END_ von _TOTAL_ Einträgen ", sInfoEmpty:" 0 bis 0 von 0 Eintrà ¤gen ", sInfoFiltered:" (gefiltert von _MAX_ Einträgen) ", sInfoPostFix:" ", sSearch:" Suchen ", oPaginate: {sFirst:" Erster ", sPrevious:" Zurück ", sNext:" Nächster " , Slast: "Letzter"}}, iDisplayLength: 10, sAjaxSource: "from & lt;% = ivy.html.startref (" API / WebAPI / antraege.ivp ")% & gt; asUid = & LT;% = ivy .html ?. $ (".usUid")% $ (".dataset"). ("Click", function () {antragid = this.id; $ .ajax ({url: "& lt;% = Ivy.html.startref ("API / WebAPI / A ntrag.ivp ")% & gt;", datatype: "json", contentType: "application / json; charset = utf-8", data: {ID: antragid}, success: function (data) {(data Virus key in) {$ ('#' + key) Html (data [key])}}}})})}) and lieutenant; / Script & gt;   

Now, because I'm using it on a workflow tool, which is working with templates, I can not put this code in the header (otherwise it will load on every page Will use this template), so I have been put it in the body tag, it does not know that it can affect this problem.

Now, comes the strange part: When I copy the above code and execute it in Chrome JS console, makes it an event-binding, so the details will be inserted into another table.

Am I doing something wrong? An application using live method still works without a problem.

Thanks

you

  $ ( Click on to dynamically click on .on (dynamic) to work in the dynamic added element. "Click", "dataset", function () {.....   

This works for the document .. but it is even better if you have the closest parent < / P>

More about delegated programs / html>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -