Currently, I am in the process of creating selectable and draggable elements for a table. You can test the functionality by following this JsFiddle link (please try vertically selecting). Initially, the selection works well but upon trying to select for the second time, it may appear distorted like the image shown below:
https://i.sstatic.net/XA1ZM.png
I have observed that after making the first-time selection, clicking on the header of my table seemed to fix the issue with the second-time selection. Therefore, I decided to programmatically click on the table header every time a selection is made as follows:
function mouseReleased(e) {
jQuery(".scheduler .header")[0].click();
......
}
To ensure the click event is triggered properly, I added the following check:
jQuery(".scheduler .header").click(function(e) {
console.log("Header Clicked !!");
});
However, I'm facing an issue where the programmatic click does not seem to work as expected. Is there a difference between programmatically clicking and manually clicking on an element?
Bonus Question: What could possibly be wrong with my script or CSS that prevents me from successfully selecting columns in the table?