Need to run fnAdjustColumnSizing after Search-string changes

Need to run fnAdjustColumnSizing after Search-string changes

kwein1kwein1 Posts: 16Questions: 2Answers: 0

I am pulling a table of about 6000 records in via ajax, using url:myprog.php. Using fixedColumns for the first column. Columns auto-adjust their width. Since the paging feature only brings in 10 lines at a time to display, it's very fast. If I type "a" into the Search field, it brings up all records starting with a. So far, so good.

If I type "ab" into the Search field, only one record is retrieved. That's the right #. But since the width of the value in the first column is wider now than previously, a horizontal scrollbar shows up, obscuring this field. Bad.

I have added a button to the HTML that calls fnAdjustColumnSizing. If I click this button, or if I resize the browser window, DataTables automagically recalculates the cell widths, and it redisplays just right.

What I would like to do is: every time the search string changes and a fresh set of records are displayed, automatically re-run fnAdjustColumnSizing. I have tried including this in fnDrawCallback and other locations. It either delays the initial redrawing until all 6000 records seem to have been loaded in (about 50 seconds), or it says that fnAdjust... is not a function.

Where should I put the fnAdjustColumnSizing() call so that it will only kick off after a fresh set of records have been drawn on the screen? I apologize that because of the complexities of my ugly code it's difficult to post helpful snippets here.

Answers

  • kwein1kwein1 Posts: 16Questions: 2Answers: 0

    Oh, I'm using DataTables 1.10.9, FixedColumns 3.1.0.

This discussion has been closed.