FixedColumns

FixedColumns

jigr1969jigr1969 Posts: 4Questions: 0Answers: 0
edited April 2012 in General
Hi there.

My first post, so please be gentle with me if I don't submit enough information. I was wondering if anyone has come across a problem where they are using jQuery UI Tabs, dataTables and FixedColumns plugin.

I have four tabs, three of which contain a dataTable, each dataTable also has the plugin FixedColumns attached such that a shallow but wide table can be scrolled with the leftmost column fixed in place. The dataTables are loaded via an Ajax call, which all works great until I initiate the FixedColumns option. When I press the submit button, the left most column header disappears, and the right most column of data also vanishes! Repeatedly pressing the submit button will eventually render a single column containing the last column header and the first data column.

I've tried recreating the datatables by using the fnDestroy function as well as the jQuery remove but neither alter the above problem.

Any ideas?

Replies

  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Welcome to the DataTables forums :-)

    > When I press the submit button

    What submit button? :-). What is it that you are trying to do? So you press the button and the form submits? Or are you doing it by Ajax? Can you link us to your page please?

    Allan
  • jigr1969jigr1969 Posts: 4Questions: 0Answers: 0
    Hi Allan. Sorry it's been a while since I've updated this post, been very busy with other projects. However, I'm back onto this and have created a WWW facing web page simplified greatly. The URL is http://www.grantzone.net/test/index.php and as you can see is a simple web page, containing one element which is a search button (magnifying icon).

    The idea behind this is that the original page has more form elements which dependent upon contents retrieve information via Ajax and populates a JS array which is used for my data table. Now these form elements can be amended and the search button pressed again, which should populate the form with new data. I cannot use the bRetrieve since I'm after new data, thus use the bDestroy method.

    As you can see, with subsequent presses of the button, the heading loses the left hand most heading, and the right hand most data column disappears. This continues until the only thing that is left is the fixed column. Now if you increase the number of fixed columns to say 2, with each click of the search button, 2 columns now disappear.

    Any help you can offer me, or any explanation of why this is happening, I would appreciate a lot.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    > I cannot use the bRetrieve since I'm after new data

    With new columns, or just new data. If just new data then use fnClearTable and fnAddData - it will be much faster. However, if you are changing the columns or the table configuration, then yes, you'll need to destroy the table. (edit - looks like it is a complete refresh of the whole table - sorry - leaving for reference though :-) ).

    > As you can see, with subsequent presses of the button [...]

    If you disable FixedColumns does it work as you would expect? FixedColumns doesn't actually have a hook for the DataTables destroy event at the moment which is going to be badly messing up the DOM on each destroy event. I need to add that particular feature to FixedColumns - added to the to-do list :-)

    Allan
  • jigr1969jigr1969 Posts: 4Questions: 0Answers: 0
    Thanks for the prompt reply Allan. It will be just the data changing, so I shouldn't need to nuke the whole table. Hopefully just the clear table and add data would suffice so this particular application. I will try that and let you know.

    If I do nuke the table and don't have the fixed columns set, then it all works as I would expect.

    Cheers
  • jigr1969jigr1969 Posts: 4Questions: 0Answers: 0
    Hi Allan. Just to let you know that I've got it working, using your suggestion above. Thanks once again for your help.
  • allanallan Posts: 63,397Questions: 1Answers: 10,451 Site admin
    Excellent to hear - thanks for the feedback :-)

    Allan
This discussion has been closed.