jQuery functions only work on 1st pagination

jQuery functions only work on 1st pagination

orangeorange Posts: 20Questions: 0Answers: 0
edited March 2010 in General
Hi,

I'm running some jQuery markup on a table and it works great on page one of a paginated table but does not work on any of the later pages.

Here is what I currently have going:

[code]
$(document).ready(function() {
$.getJSON( 'jason', null, function(json) {
$('#quote_pipeline').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aaData": json.aaData,
"aoColumns":
json.aoColumns
});

$('tr td:nth-child(2)').wrapInner(function() {
return ''; });
});
});
[/code]

Any help would be appreciated.

thank you.

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Please see the FAQ entitled "My events don't work on the second page": http://datatables.net/faqs - which I bleieve will address this for you.

    Allan
  • orangeorange Posts: 20Questions: 0Answers: 0
    Hi Allan,

    Thanks for your reply; I'm still struggling with this and have tried to set it up like the 'pre-initialization' example. Anyone see why this isn't working?

    [code]
    $(document).ready(function() {

    //Find the index position of the column header title
    //Put the index in a variable called "position"
    var i = $('thead th:contains(CRM Account)').next().index();
    //Find every cell with the column index matching "position"
    //Iterate (.each) over the table and add markup to those cells
    $('#quote_pipeline tbody tr td:nth-child(' + i + ')').each(function()
    {

    $(this).wrapInner(function() {
    return ''
    })



    });



    $.getJSON('jason', null,
    function(json) {


    $('#quote_pipeline').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "aaData": json.aaData,
    "aoColumns":
    json.aoColumns

    });


    });

    });
    [/code]
  • orangeorange Posts: 20Questions: 0Answers: 0
    I should add that the table renders fine but none of the first jQuery formatting is showing up (not even on the first page).

    thank you,
    orange
  • orangeorange Posts: 20Questions: 0Answers: 0
    edited March 2010
    I'm now trying to implement the fnGetNodes and have got this far:

    [code]
    $(document).ready(function() {


    $.getJSON('jason', null,
    function(json) {

    oTable = $('#quote_pipeline').dataTable({
    "aaData": json.aaData,
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "aoColumns": json.aoColumns

    });

    var myNodes = $(oTable.fnGetNodes());

    myNodes.each(function() {

    var i = $('thead th:contains(CRM Account)').next().index();
    $('tbody tr td:nth-child(' + i + ')').each(function()
    {
    $(this).wrapInner(function() {
    return '';

    });

    });

    });




    });






    });
    [/code]

    script timing out.



    thank you,
    orange
  • orangeorange Posts: 20Questions: 0Answers: 0
    I'm going to sink this discussion and open a new one. Thank you.
This discussion has been closed.