meetselva / fixed-table-rows-cols

Fixed Table Header and Columns
http://meetselva.github.com/fixed-table-rows-cols/
Other
77 stars 42 forks source link

Fixed column is causing issue in case if I dynamically hide the columns #34

Open Anu13sree opened 8 years ago

Anu13sree commented 8 years ago

Fixed column is causing issue in case if I dynamically hide the columns. The cloned column width is not getting updated. I would need to know how can we destroy the table and create the same again.

Thanks in advance. capture

Anu13sree commented 8 years ago

@meetselva Can you please let me know is there any way to achieve the same?

meetselva commented 8 years ago

@Anu13sree Apologies, I was out for sometime and did not had time to check my messages.

Rebuilding isn't currently available in the plugin, but we should be able to strip off all changes and call the plugin again.

Let me check..

meetselva commented 8 years ago

I wrote a simple revert code that would revert most changes and allows you to call the plugin again to rebuild the table.

$fixedTable = <your fixed table selector> $fixedTable.closest('.ft_scroller').unbind('scroll'); $fixedTable.closest('.ft_rel_container').find('.ft_rc, .ft_cwrapper, .ft_rwrapper').remove(); $fixedTable.unwrap().unwrap().unwrap().removeClass('ui-widget-header').find('.ui-widget-content').removeClass('.ui-widget-content');

**Feel free to adjust the above code, it is just a rough code to remove all elements that plugin included to create a fixed row/column.

A working example: http://codepen.io/meetselva/pen/qNJNYQ - Try the 'Apply Plugin' button and the 'Destroy' button to see how the plugin code is reverted.

Note: Destroy does not fully revert all the changes. Changes such as width/align set to each TD/Table are not reverted. However, when the plugin is called again after changes, it will rebuild/adjust the width.

Also Do not forget to adjust the colModal after removing a column.

Anu13sree commented 8 years ago

Thanks @meetselva for the quick response and the solution :+1: But can you let me know how we can add dynamic width to the colspan parameter.