off the stack

Grouped rows (old experiment)

2013-09-03

While digging through a pile of files today I found something interesting back.

A small JS experiment with the idea of having multiple views on the same data, grouped by some criteria. The data is defined up front and the views group and manipulate the data. While manipulation happens, views are kept in sync using simple callbacks and events.

I wrote this about 5 years ago I think, while I was working on some restaurant review website. The content managers could - along with other information - enter the opening times of a restaurant. The editing functionality provided two views, one grouped by the day of the week and one grouped by type (breakfast, lunch, brunch ...). On the day view, one would be able to change the type, which effectively changed the opening time row position on the type based view.

The original solution available inside the CMS handled most of the logic on the server side, spitting out some HTML form with a few controls. Changing the data and switching between the view modes happened with a form submit. That got the job done, but felt a little clumsy. So, within my spare time, I started to give it another try, starting from scratch, fiddling with this concept of grouped data rows.

After a short while the following code was written, and has been forgotten a few days later (being still incomplete).

In retrospective, there are a couple of things I would do different now of course. But this is just for reference.