I want to build a sortable table and a treeview. Are there examples of how to do this in Rails? If I wanted to componentize this, would I use a helper, or partial or component (or else) and why? John McClain Senior Software Engineer TCS Healthcare email@example.com (530)886-1700x235 "Skepticism is the first step toward truth"
on 2005-12-22 22:20
on 2005-12-27 23:25
I'd suggest a helper. The other form fields used in rails are all helpers. This approach lets you write the think in ruby, and have it available in all views. A helper can be packaged up as a plugin if you want it to be easily distributed to other people. The only way in which this might cause you trouble is if you want to be able to have links on your table which trigger another server query (whether it's an ajax query of a full page refresh). In this case, nether helpers or partials will work, since they are just display logic, and don't include any control handling. So, if you need to query the server, then you need a controller as well. In order to 'componentise' such a think for use by third parties, you may want to make it into a component, however there is a bit of juggling needed in order to get a component to handle server queries relative to the current page. Craig