fnOpen, fnAddData together - example
fnOpen, fnAddData together - example
If someone wants to use fnOpen with fnAddData they might use this example:
Create object for html content (th is static, so we can use whole like) in td we need only the content of the cell:
[code]
var html_content = {
"exampleOptNodeTh": 'Actions',
"exampleOptNodeTd": ''
};
// we create the td node and append to visible rows (haven't checked if this will work in ajax source, probably you would net to bind the function to add columns automatically
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = html_content.exampleOptNodeTd;
// we only need to do this once - no need for each
$('#example_table thead tr').prepend(html_content.exampleOptNodeTh);
$('#example_table tbody tr').each( function () {
$(this).prepend(nCloneTd);
} );
//initialize data table
// and add new row
var aoData = oTable.fnAddData( [html_content.exampleOptNodeTd,'column2','column3'] );
[/code]
this code appends the needed option content for the next cell when using fnAddData - of course there may be easier way :) Hope that someone could use it
Create object for html content (th is static, so we can use whole like) in td we need only the content of the cell:
[code]
var html_content = {
"exampleOptNodeTh": 'Actions',
"exampleOptNodeTd": ''
};
// we create the td node and append to visible rows (haven't checked if this will work in ajax source, probably you would net to bind the function to add columns automatically
var nCloneTd = document.createElement( 'td' );
nCloneTd.innerHTML = html_content.exampleOptNodeTd;
// we only need to do this once - no need for each
$('#example_table thead tr').prepend(html_content.exampleOptNodeTh);
$('#example_table tbody tr').each( function () {
$(this).prepend(nCloneTd);
} );
//initialize data table
// and add new row
var aoData = oTable.fnAddData( [html_content.exampleOptNodeTd,'column2','column3'] );
[/code]
this code appends the needed option content for the next cell when using fnAddData - of course there may be easier way :) Hope that someone could use it
This discussion has been closed.
Replies
Nice one - thanks very much for sharing your code with everyone!
Just for clarity - what is fnGetOpen()?
Regards,
Allan
Regards,
Allan