Problem with jquery opener and jquery datatable
Currently i am building a membership search page using jquery and jquery datatable plugin.
The flow is when the user click button Search Member, a new window appear containing list of member.
The list of member is using jquery datatable. When user click Add, the member data is add back to the opener window.
However whenever i click to the next page or search, the Add link will not work anymore. Checking Firebug console does not show any error.
I upload the video for your better understanding of the problem.
http://www.mediafire.com/?n2cjgibohpjdima
The Add link contain add_member class.
<a href="#" class="add_member">Add</a>
Here is the code for the javascript:
$(document).ready(function() {
$('#example').dataTable();
$(".add_member").click(function() {
var id = $(this).closest('tr').attr('id');
var name = $('tr#'+id+' td#row_name').text();
var ic = $('tr#'+id+' td#row_ic').text();
var phone = $('tr#'+id+' td#row_phone').text();
var dob = $('tr#'+id+' td#row_dob').text();
var blacklist = $('tr#'+id+' td#row_blacklist').text();
var cust_name = window.opener.jQuery("#cust_name");
var cust_phone = window.opener.jQuery("#cust_phone");
var cust_ref = window.opener.jQuery("#cust_ref");
var cust_dob = window.opener.jQuery("#cust_dob");
cust_name.val(name);
cust_phone.val(phone);
cust_ref.val(ic);
cust_dob.val(dob);
window.close(开发者_开发百科);
});
});
Thank you in advance :)
However whenever i click to the next page or search, the Add link will not work anymore.
Are you adding Add link dynamically ? If so modify like this -
$(".add_member").live('click', function() {
.........
.........
}
you can try using
function pageLoad(sender, args) {
if (args.get_isPartialLoad()) {
<your code here>
}
}
without the document.ready it will rebind your button click after every postback I fixed an issue that way
精彩评论