adding and editting grid now works with foreignkeys.

Code cleanup and refactoring for grids.
Merge branch 'slickgrid' of github.com:visgence/portcullis into slickgrid