Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I would like to implement resizable table columns, such that when you click and drag on a "notch" on the right side of the th (just a styled div inside the th), a new "marquee" element is created inside the th and displayed as a guide for resizing. On mouseup, the marquee disappears and the th element's width is set to the new width.

I have created a fiddle to illustrate.

It seems like the answer is to create a directive, but my main hangup is how to handle the dynamically-added window mousemove listener plus the "one" window mouseup listener within the directive logic.

share|improve this question
    
I don't understand what you mean by "how to handle". You already have a working solution, don't you? –  zeroflagL Apr 15 at 19:05
    
My understanding is that the OP would like to know how to convert the solution he has into Angular, most probably using a directive. –  Michal Charemza Apr 15 at 19:08
    
Place your fiddle in the postLink callback of a directive. Calls like $th.width() won't work unless the table is already visible in the DOM. If the directive is using a template to create the table. You might have to use $timeout. Otherwise, I don't see anything in your fiddle that can be done in a directive. –  Mathew Foscarini Apr 15 at 19:17
    
@MichalCharemza thanks for editing and clarifying, that is what I am looking for. Mathew Foscarini thanks for the insight. I'll give that a shot. –  AndyPerlitch Apr 15 at 20:37
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.