Not exactly clear what you are after. If you are looking to add a dynamic amount of rows and columns based on data (objects), then you could either look at an option to have a list view within a list view (and style as columns and rows), or take a look at this widget.
There is no direct way for this problem.
We had tried to solve this by adding dynamic class to a column and control visibility but it didn't work for us..
The dirty work around solution we had to implement was to determine possible columns prior opening the page with datagrid 2 and hide and show the datagrids based on the no of columns.. i e say if there can be maximum 10 columns in a page we have 10 data grids with various number of columns.. based on the number of columns to be visible we show that grid.
Looking forward to see a nice work around solution for this.