refresh javascript on Page Next / Back
refresh javascript on Page Next / Back
Hi I was wondering if there was a way to refresh the javascript on my page. I have a link in one of my 's that opens up a overlay. This only works on the first page of data and if I go to the next page it doesn't work. My code is below. I know it's probably an easy solution. I'm definitely a newbie at javascript. Any help would be greatly appreciated.
I'm using the codeidniter framework.
[code]
$(document).ready(function() {
$('#example').dataTable( {
"sDom": '<"top"i>rt<"bottom"flp<"clear">'
} );
} );
Last Name
First Name
Phone
Cell Phone
email
<?php
foreach ($result as $row) {
echo '' .
'' . $row->last_name . '' .
'' . $row->first_name . '' .
'' . $row->phone . '' .
'' . $row->cell_phone . '' .
''.$row->email.'' .
'view'.
'edit'.
'delete'.
'';
}
?>
Last Name
First Name
Phone
Cell Phone
email
<!-- overlayed element -->
<!-- the external content is loaded inside this tag -->
<!-- make all links with the 'rel' attribute open overlays -->
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
expose: 'black',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getContent().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
[/code]
I'm using the codeidniter framework.
[code]
$(document).ready(function() {
$('#example').dataTable( {
"sDom": '<"top"i>rt<"bottom"flp<"clear">'
} );
} );
Last Name
First Name
Phone
Cell Phone
<?php
foreach ($result as $row) {
echo '' .
'' . $row->last_name . '' .
'' . $row->first_name . '' .
'' . $row->phone . '' .
'' . $row->cell_phone . '' .
''.$row->email.'' .
'view'.
'edit'.
'delete'.
'';
}
?>
Last Name
First Name
Phone
Cell Phone
<!-- overlayed element -->
<!-- the external content is loaded inside this tag -->
<!-- make all links with the 'rel' attribute open overlays -->
$(function() {
// if the function argument is given to overlay,
// it is assumed to be the onBeforeLoad event listener
$("a[rel]").overlay({
expose: 'black',
effect: 'apple',
onBeforeLoad: function() {
// grab wrapper element inside content
var wrap = this.getContent().find(".contentWrap");
// load the page specified in the trigger
wrap.load(this.getTrigger().attr("href"));
}
});
});
[/code]
This discussion has been closed.
Replies
http://datatables.net/examples/advanced_init/events_post_init.html
Should be as simple as storing a global variable to the table and then using $("a[rel]", oTable.fnGetNodes()).overlay({...});
Or you can initialise the DataTable after the overlay:
http://datatables.net/examples/advanced_init/events_pre_init.html
Allan