How to emulate user actions to resize columns

Tags: #<Tag:0x00007f51befc1ea0> #<Tag:0x00007f51befc1cc0>

Hi

I need to test the effect of changing the column width in a table on the subsequent order of columns.

I need to write an autotest in which I change the width of the newly added columns, reload the page and watch the result, monitoring the correctness of the action.

As far as I can tell, when changing the size, the manualColumnResize plugin is activated. First, it is activated when hovering the mouse cursor over the column header. A div with a class .manualColumnResizer appears in the DOM page. It is responsible for further changes.

Experimentally, I found that such actions in the browser console:

hot.getPlugin(‘ManualColumnResize’).setManualSize(column_index, new_width);
hot.render()

result in a change of width, but the result is not saved when the page is refreshed and does not trigger a width change event, which does not allow using code to simulate a user action.

I tried to directly access the table header via jQuery or javascript, but nothing works.

Can anyone advise on this issue?

Thank you, Edward.

Hi @galogenit

If you you would like to have the new column width (added via setManualSize() execution or manual action) you’d need to either

Here tests_manualColumnResize are the tests that we have for similar actions. I hope it helps.

1 Like