Skip navigation

I don’t claim to be a good coder. Even less so when it comes to web development, which I consider to be icky poo-poo even with modern toys like Foundation and Knockout. My point: you’re about to see some stuff I’ve cobbled together. I don’t know if it’s any good, but I hope it helps someone.

So I’m really still a complete n00b when it comes to both Foundation and Knockout, but I’ve seen enough to know I like them both. I’ve also seen enough to have run into problems as I try to use them together.┬áHere’s a fun one… suppose you want to use Tabs. At first glance, that’s no problem!

Nothing new or special there, and it works. Now, what if the array of Tabs might change mid-stream due to something the user’s done? You’d figure Knockout would take care of that for you like it takes care of everything else. But you’d be wrong. Well, half wrong. I think Knockout really does try. Foundation, however, is being stubborn.

Foundation and KnockoutIt’s not documented very well anywhere that I could find, but it looks like Foundation gets kind of drowsy after rendering the page, and you gotta poke it when something like this changes. I don’t know what’s special about Tabs and Accordions (yeah, it happens with them both, and possibly other stuff as well) when compared to all the other things Foundation does correctly in partnership with Knockout, but in any case, there is a solution:

Add that custom binding, and use it like so:

It took some digging to find it, but that reflow call is the poke of which I spoke. And don’t worry, it doesn’t look like it’ll really impact performance. In fact, it was written for this kind of thing. …and then never advertised.