|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
DataTable GenericsQuestion please. "DataTable"s can have one or more columns. According
to the constructor each IColumn must have the same model object type. What is the logic behind that? I would assume that each column can have a different model object type. public DataTable(String id, IColumn<T>[] columns, IDataProvider<T> dataProvider, int rowsPerPage) Juergen |
|
|
Re: DataTable Genericsit is because populateItem is passed in the model that represents the
row of the table, just like listview. IColumn extends ICellPopulator<T> which has the populateItem that takes IModel<T> -igor On Fri, Jul 31, 2009 at 11:16 AM, Juergen Donnerstag<juergen.donnerstag@...> wrote: > Question please. "DataTable"s can have one or more columns. According > to the constructor each IColumn must have the same model object type. > What is the logic behind that? I would assume that each column can > have a different model object type. > > public DataTable(String id, IColumn<T>[] columns, IDataProvider<T> > dataProvider, int rowsPerPage) > > Juergen > |
|
|
Re: DataTable GenericsI understand the technical reason, but I find it strange/wrong to
assume that all columns require the same model object type. Which means that more often than not you end up with Object as type. And because the provider requires the same type (Object) ... Does applying Generics provide any value here? Juergen On Fri, Jul 31, 2009 at 8:45 PM, Igor Vaynberg<igor.vaynberg@...> wrote: > it is because populateItem is passed in the model that represents the > row of the table, just like listview. > > IColumn extends ICellPopulator<T> which has the populateItem that > takes IModel<T> > > -igor > > On Fri, Jul 31, 2009 at 11:16 AM, Juergen > Donnerstag<juergen.donnerstag@...> wrote: >> Question please. "DataTable"s can have one or more columns. According >> to the constructor each IColumn must have the same model object type. >> What is the logic behind that? I would assume that each column can >> have a different model object type. >> >> public DataTable(String id, IColumn<T>[] columns, IDataProvider<T> >> dataProvider, int rowsPerPage) >> >> Juergen >> > |
|
|
Re: DataTable GenericsJuergen Donnerstag wrote:
> Question please. "DataTable"s can have one or more columns. According > to the constructor each IColumn must have the same model object type. > What is the logic behind that? I would assume that each column can > have a different model object type. > > public DataTable(String id, IColumn<T>[] columns, IDataProvider<T> > dataProvider, int rowsPerPage) I'm afraid your assumption is incorrect. Each IColumn<T> represents a way of rendering a facet of an object of type T. The DataTable obtains a collection of objects of type T from the IDataProvider<T>, and passes them *one* *per* *row* to the IColumn<T> implementations to populate the cells. The T in IColumn<T> is the type of the model objects that are being iterated over row by row, and *not* anything to do with the facet of that object that is displayed in the column in question. Max. |
| Free embeddable forum powered by Nabble | Forum Help |