Patch for Datatable using...

Oct 8, 2007 at 9:28 AM
Have you seen my Patch wich I have uploaded to use a Datatable to fill your list!

Is there a chang that it goes into your version?
Coordinator
Oct 15, 2007 at 2:41 PM
Hi,

Have you looked at my ClickAndQuery example? I didn't need to add a column parameter to achieve a similar thing. The code is in ResultsControl.cs.
Nov 19, 2008 at 2:12 AM
Disculpas, No soy bueno escribiendo en ingles.
Mi pregunta es, donde puedo obtener el codigo  "The code is in ResultsControl.cs"

Mil gracias, y es un excelente control.
Developer
Nov 25, 2008 at 1:54 PM
Where can I find the ClickAndQuery example? I used the implementation proposed by Daniel_Medina on the CodeProject website

This involves one new class DataRowColumn and two minor additions to existing classes.
Add the using directive System.Data to the class ListControl and add the following lines of code:
#region Datatable methods
public void FillList(DataTable table)
{
    if (table != null)
        Items.AddRange(table.Rows);
}

public void FillColumns(DataTable table)
{
    if (table != null)
    {
        foreach (DataColumn col in table.Columns)
        {
            DataRowColumn guiCol = new DataRowColumn(col.ColumnName, col.ColumnName, 120, null, col.Ordinal);
            Columns.Add(guiCol);
        }
    }
}
#endregion

The function public int Compare(object x, object y) in the class ColumnComparer in the file BufferedItemList.cs needs some extra lines of code, just before the end:
//NEW PART            
            if (x is DataRow)
            {
                try
                {
                    DataRow dx = x as DataRow;
                    DataRow dy = y as DataRow;
                    return ((IComparable)dx[0]).CompareTo(dy);
                }
                catch
                {
                    return 1;
                }
            }
//END OF NEW PART
            if (_list.ObjectComparer == null)
                throw new InvalidOperationException("ItemList.ObjectComparer must be set");


Isn't this something to consider adding to the project to make the SuperList control even more usefull?
Coordinator
Nov 25, 2008 at 8:40 PM
Hi it should be under the Examples folder.

Regards
Lee