- Or how do you group and array of objects?
I have a situation where I need to group and sort data that can change form during runtime. I basically have an ArrayList of ArrayLists. That data takes the form of the outer ArrayList being the rows, and an inner ArrayList being the columns. For example the data will look like this:
m_data = new ArrayList(8);
MyList inner;
inner = new MyList(3);
inner.Add(new SampleData("Ray"));
inner.Add(new SampleData("Red"));
inner.Add(new SampleData("42"));
m_data.Add(inner);
inner = new MyList(3);
inner.Add(new SampleData("Joe"));
inner.Add(new SampleData("Black"));
inner.Add(new SampleData("66"));
m_data.Add(inner);
The number of columns can change, but they will always be made up of the same object. The columns that are grouped and sorted will change.
I took the approach of using a custom Categorizer, and this works fine if I only group on one column, but not on two or more. I suspect that I will need my own Comparer, but I don’t have enough context to know what values I need to compare. It seems that the SortColumnDescriptor name is used as the property name for the object. How can I use a different name for the SortColumnDescriptor that is used to obtain the property value that is used for the sort?
I have enclosed a simplified version of the code that demonstrates things better then I can explain then in text.
Ken
SuperSimple.zip