This post originated from an RSS feed registered with Agile Buzz
by James Robertson.
Original Post: Adding Columns to a DataSet
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Here's a perennial favorite in VisualWorks: You have a dataset widget, and you would like to dynamically add a column at runtime. How do you do that? Well, there's been a support tip on this for years - and I made use of that tip in BottomFeeder. The all new view has 2 modes:
Show a restricted tree, with only the new items
Show all new items in a 2 pane (no tree) view
For the latter view, we add a column (with the feed name) to the dataset, so that you can tell where the item in question came from. So how is that accomplished? Here's the relevant code snippet:
The spec is the spec for a single column - I extracted a column spec (copy) from a dataset spec, changed the attributes to match what I wanted, then saved the result as a class method. Then, at runtime, I can grab that spec object, and just slam it into the dataset. It can be removed just as easily. That's it!