Just render the DOM in dynamic creation with JSON
Just render the DOM in dynamic creation with JSON
Hello,
I use dataTable with JSON dynamic creation, and I would like to apply a function (Jquery contextMenu) in each row of this table (on a particular span in a particular td but nevermind...).
The issue is, if I apply my function after the dataTable() function, only the 5 first rows are concerned (iDisplayLength = 5) because the DOM is not formed.
I found a solution to this problem, but I think it is not optimised at all :
I draw the dable, I use the new function 1.7 fnDestroy(), I apply my function, and redraw the form.
But the JSON dynamic creation has no more interest for optimisation (or less) in this case.
I wonder if it would exist a function that just render my JSON objet into the DOM in order to apply my function, and then draw, without draw it first. (Hope you will understand me ^^).
Thanks for your answers and sorry for my english i'm french ^^
I use dataTable with JSON dynamic creation, and I would like to apply a function (Jquery contextMenu) in each row of this table (on a particular span in a particular td but nevermind...).
The issue is, if I apply my function after the dataTable() function, only the 5 first rows are concerned (iDisplayLength = 5) because the DOM is not formed.
I found a solution to this problem, but I think it is not optimised at all :
I draw the dable, I use the new function 1.7 fnDestroy(), I apply my function, and redraw the form.
But the JSON dynamic creation has no more interest for optimisation (or less) in this case.
I wonder if it would exist a function that just render my JSON objet into the DOM in order to apply my function, and then draw, without draw it first. (Hope you will understand me ^^).
Thanks for your answers and sorry for my english i'm french ^^
This discussion has been closed.
Replies
[code]
$('#example tbody tr td:eq(0)>span').whatever();
[/code]
do
[code]
$('td:eq(0)>span', oTable.fnGetNodes()).whatever();
[/code]
fnGetNodes will get an array of all TR elements in the table which you can then work on.
Allan
I'm going to try that.