1

After a long exhausting search, I have found no answer to my question anywhere. Basically I have dynamically creating a table based on inputs by a user and also inserting a row with only a button after every 4th entry in the table. What I need is for the sorting function to ignore the rows with the button and leave them in place while sorting the rest of the table. Does anyone know if this is even possible?

1
  • Could you post the markup & JQuery? Maybe a JSFiddle? :) Commented Apr 27, 2012 at 20:47

2 Answers 2

1

You don't - what to do is use DataTables fnDrawCallback to insert your fourth row on each draw. DataTables will always empty the <tbody> element on each draw, so this would be required anyway.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much, only problem now is it puts the entries at the end of the table instead of in the appropriate spots. Code is as follows: "fnDrawCallback": function (oSettings) { var rows = $('.searchResultRow'); rows.each(function (index) { if (index == 4 || index == 9) { var insertLearn = $("<tr></tr>").addClass("searchResultRow "); insertLearn.append(buildCell().attr('colspan', 9).html("<img src='../img/LearnMoreAnimated_v1-1.gif' />")); $("#results_table > tbody").append(insertLearn); } });
1
"fnDrawCallback": function (oSettings) {                  }
                    var rows = $('.searchResultRow');

                    rows.each(function (index) {

                        if (index == 4 || index == 9) {
                            var insertLearn = $("<tr></tr>").addClass("searchResultRow ");

                            insertLearn.append(buildCell().attr('colspan', 9).html("<img src='../img/LearnMoreAnimated_v1-1.gif' />"));

                            $("#results_table > tbody > tr").eq(index).after(insertLearn);
                        }

                    });
                }

was how I was able to get it....thanks for the help in pointing me in the right direction.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.