Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Where to bind autosize() for Todo MVC?

$
0
0
Similar to my question over here https://forum.javascriptmvc.com/topic/where-to-bind-sortable-for-a-can-component

It is not clear to me where I would apply jquery.autosize() [http://www.jacklmoore.com/autosize/] to the textareas that are automatically dropped into the todos-list: http://todomvc.com/examples/canjs_require/

When live binding adds or removes todos, each with a text areas, how would I attach autosize to those elements as they're added (and detach when removed)? is there an inserted/deleted event for iterated items in a mustache template?

I think doing it onfocus would be too late, since any todo with sufficiently large text should autosize before focus.

Note: Just re-reviewed the CanJS ToDo sample, the items in the list are rendered as labels, and so wrap correctly in the list - until you double click on them. So, for the ToDoMVC example, probably just calling autosize() in the "edit" function would work. However, in my example, I'm just using textareas for each todo w/ no "edit mode" behavior. Again, just trying to figure out where plugin bindings should be applied/removed for items added via live-binding.

I appreciate any insight.

Best,
Mark

Viewing all articles
Browse latest Browse all 3491

Trending Articles