Class DataTableList
Represents a class that provides support for IBindingList that wraps a DataTable and provides optimized access to the rows of the data table.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Grouping
Assembly: Syncfusion.Grouping.Base.dll
Syntax
public class DataTableList : IBindingList, IList, ICollection, IEnumerable, ITypedList, IGroupingList, IGroupingColumnChanging, IDisposable
Remarks
The Engine will access a DataTable through this wrapper class instead of accessing records through the DataTable.DefaultView to increase performance when adding, removing, and changing records when AllowSwapDataViewWithDataTableList is enabled.
Constructors
DataTableList(DataTable)
Initializes a new instance of the DataTableList class and attaches it to the wrapped DataTable.
Declaration
public DataTableList(DataTable dt)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dt | The DataTable to be wrapped. |
Fields
ChangedRowIndex
Used for the index of changed row.
Declaration
public static int ChangedRowIndex
Field Value
Type |
---|
System.Int32 |
Properties
AllowEdit
Always True.
Declaration
public bool AllowEdit { get; }
Property Value
Type |
---|
System.Boolean |
AllowItemReference
Gets the value indicating whether the item reference is enabled or not.
Declaration
public bool AllowItemReference { get; }
Property Value
Type |
---|
System.Boolean |
AllowNew
Gets a value indicating whether the AllowNew property is enabled not.
Declaration
public bool AllowNew { get; }
Property Value
Type |
---|
System.Boolean |
AllowRemove
Gets the value indicating whether the allow remove is enabled or not.
Declaration
public bool AllowRemove { get; }
Property Value
Type |
---|
System.Boolean |
Count
Gets the number of elements contained in collection.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
DataTable
Gets the underlying DataTable.
Declaration
public DataTable DataTable { get; }
Property Value
Type |
---|
System.Data.DataTable |
GroupingSortBehavior
Not implemented.
Declaration
public GroupingSortBehavior GroupingSortBehavior { get; }
Property Value
Type |
---|
GroupingSortBehavior |
IsReadOnly
Gets a value indicating whether the collection is read-only or not.
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
---|
System.Boolean |
IsSorted
Gets the value indicating whether the columns are sorted or not.
Declaration
public bool IsSorted { get; }
Property Value
Type |
---|
System.Boolean |
IsSynchronized
Not implemented.
Declaration
public bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[Int32]
Gets the element at the specified index.
Declaration
public object this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
System.Object |
Remarks
Setting is not supported and will throw an exception since the collection is Read-only.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Since the collection is read-only, if the set operation is performed the exception occurs. |
SortDirection
Gets the value of sort direction.
Declaration
public ListSortDirection SortDirection { get; }
Property Value
Type |
---|
System.ComponentModel.ListSortDirection |
SortProperty
Not implemented.
Declaration
public PropertyDescriptor SortProperty { get; }
Property Value
Type |
---|
System.ComponentModel.PropertyDescriptor |
SupportsChangeNotification
Gets a value indicating whether the notification changes is supported or not.
Declaration
public bool SupportsChangeNotification { get; }
Property Value
Type |
---|
System.Boolean |
SupportsGroupSorting
Gets the value indicating whether group sorting is enabled or not.
Declaration
public bool SupportsGroupSorting { get; }
Property Value
Type |
---|
System.Boolean |
SupportsSearching
Gets the value indicating whether searching is supported or not..
Declaration
public bool SupportsSearching { get; }
Property Value
Type |
---|
System.Boolean |
SupportsSorting
Gets the value indicating whether the sorting is enabled or not.
Declaration
public bool SupportsSorting { get; }
Property Value
Type |
---|
System.Boolean |
SyncRoot
Not implemented.
Declaration
public object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Methods
Add(Object)
Adds a row object to the end of the collection.
Declaration
public int Add(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The element to be added to the end of the collection. The value must not be a NULL reference (Nothing in Visual Basic). |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based collection index at which the value has been added. |
AddIndex(PropertyDescriptor)
Not implemented.
Declaration
public void AddIndex(PropertyDescriptor property)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property | The property. |
AddNew()
Adds a new row.
Declaration
public object AddNew()
Returns
Type | Description |
---|---|
System.Object | The new row. |
ApplySort(RelationChildColumnDescriptorCollection, SortColumnDescriptorCollection, SortColumnDescriptorCollection)
Not implemented.
Declaration
public void ApplySort(RelationChildColumnDescriptorCollection relationChildColumns, SortColumnDescriptorCollection groupColumns, SortColumnDescriptorCollection sortColumns)
Parameters
Type | Name | Description |
---|---|---|
RelationChildColumnDescriptorCollection | relationChildColumns | The RelationChildColumnDescriptorCollection |
SortColumnDescriptorCollection | groupColumns | The group columns |
SortColumnDescriptorCollection | sortColumns | The sort columns |
Clear()
Removes the item from the collection.
Declaration
public void Clear()
CopyTo(Array, Int32)
Copies the elements of the collection from a specific array index.
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | The one-dimensional array that is the destination of the elements copied from the ArrayList. The array must have zero-based indexing. |
System.Int32 | index | The zero-based index in an array at which copying begins. |
Dispose()
Used to release the managed resources.
Declaration
public void Dispose()
Find(PropertyDescriptor, Object)
Not implemented. Returns -1.
Declaration
public int Find(PropertyDescriptor property, object key)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property | The PropertyDescriptor |
System.Object | key | The key value |
Returns
Type | Description |
---|---|
System.Int32 | The index of value if found in the list; Otherwise, -1. |
GetDataTableRowIndexOf(DataRow)
Gets the row index.
Declaration
public static int GetDataTableRowIndexOf(DataRow row)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow | row | Given row. |
Returns
Type | Description |
---|---|
System.Int32 | Row index. |
GetEnumerator()
Gets an enumerator that iterates through a collection.
Declaration
public IEnumerator GetEnumerator()
Returns
Type | Description |
---|---|
System.Collections.IEnumerator | An enumerator. |
GetItemProperties(PropertyDescriptor[])
Gets the PropertyDescriptorCollection that represents the DataTable.Columns collection.
Declaration
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor[] | listAccessors | Array of System.ComponentModel.PropertyDescriptor objects. |
Returns
Type | Description |
---|---|
System.ComponentModel.PropertyDescriptorCollection | Property descriptor collection. |
GetListName(PropertyDescriptor[])
Gets the table name.
Declaration
public string GetListName(PropertyDescriptor[] listAccessors)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor[] | listAccessors | Array of System.ComponentModel.PropertyDescriptor objects. |
Returns
Type | Description |
---|---|
System.String | Table name. |
Insert(Int32, Object)
Inserts an element into the collection at the specified index.
Declaration
public void Insert(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which the element should be inserted. |
System.Object | value | The element to insert. The value must not be a NULL reference (Nothing in Visual Basic). |
Remove(Object)
Removes the specified row object from the collection.
Declaration
public void Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The element to remove from the collection. If the value is NULL or the element is not contained in the collection, the method will do nothing. |
RemoveAt(Int32)
Removes the element at the specified index of the collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to remove. |
RemoveIndex(PropertyDescriptor)
Not implemented.
Declaration
public void RemoveIndex(PropertyDescriptor property)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property | The propertydescriptor |
RemoveSort()
Not implemented.
Declaration
public void RemoveSort()
Events
ColumnChanging
Occurs when the grouping column changing event is done.
Declaration
public event GroupingColumnChangeEventHandler ColumnChanging
Event Type
ListChanged
Broadcasts the System.ComponentModel.IBindingList.ListChanged event.
Declaration
public event ListChangedEventHandler ListChanged
Event Type
Type |
---|
System.ComponentModel.ListChangedEventHandler |
RowRemoving
Occurs when the row removing event is done.
Declaration
public event GroupingRowEventHandler RowRemoving
Event Type
Explicit Interface Implementations
IList.Contains(Object)
Determines a value indicating whether the specified item is in the collection or not.
Declaration
bool IList.Contains(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to be located in the System.Collections.IList. |
Returns
Type | Description |
---|---|
System.Boolean | True if the System.Object is found in the System.Collections.IList; Otherwise False. |
IList.IndexOf(Object)
Always -1, the method is not implemented.
Declaration
int IList.IndexOf(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object to be located in the System.Collections.IList. |
Returns
Type | Description |
---|---|
System.Int32 | The index of value if found in the list; Otherwise, -1. |
IList.IsFixedSize
Always False since this collection has no fixed size.
Declaration
bool IList.IsFixedSize { get; }
Returns
Type |
---|
System.Boolean |