Class CurrentRecordManager
Manages the current record or element in a table and provides routines both for navigation and editing.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Grouping
Assembly: Syncfusion.Grouping.Base.dll
Syntax
public class CurrentRecordManager : IDisposable
Properties
CurrentElement
Gets or sets the current element. Setting the current element will trigger a Navigate(Int32) call.
Declaration
public Element CurrentElement { get; set; }
Property Value
Type |
---|
Element |
CurrentField
Gets or sets the current field (in a grid this is the current cell in the active record).
Declaration
public FieldDescriptor CurrentField { get; set; }
Property Value
Type |
---|
FieldDescriptor |
CurrentRecord
Gets or sets the current record. When current element is not a Record, NULL is returned, (e.g. if element is a NestedTable). Setting the current record will trigger a Navigate(Int32) call.
Declaration
public Record CurrentRecord { get; set; }
Property Value
Type |
---|
Record |
Data
Declaration
public object Data { get; }
Property Value
Type |
---|
System.Object |
EditableObject
Casts Data as System.ComponentModel.IEditableObject. NULL if Data is not of this type.
Declaration
public IEditableObject EditableObject { get; }
Property Value
Type |
---|
System.ComponentModel.IEditableObject |
HasCurrentElement
Determines if table has an active current element (either a Record or NestedTable).
Declaration
public bool HasCurrentElement { get; }
Property Value
Type |
---|
System.Boolean |
HasCurrentRecord
Determines if table has an active current element that is a Record (and not a NestedTable).
Declaration
public bool HasCurrentRecord { get; }
Property Value
Type |
---|
System.Boolean |
InBeginEdit
True while processing BeginEdit() call. Will be set to False after BeginEdit() returns.
Declaration
public bool InBeginEdit { get; }
Property Value
Type |
---|
System.Boolean |
InCancelEdit
True while processing CancelEdit() call. Will be set to False after CancelEdit() returns.
Declaration
public bool InCancelEdit { get; }
Property Value
Type |
---|
System.Boolean |
InEndEdit
Declaration
public bool InEndEdit { get; }
Property Value
Type |
---|
System.Boolean |
InEnterRecord
Gets if EnterRecord(Element) was called. Will be set to False when EnterRecord(Element) returns.
Declaration
public bool InEnterRecord { get; }
Property Value
Type |
---|
System.Boolean |
Info
Gets debug information about the object.
Declaration
public string Info { get; }
Property Value
Type |
---|
System.String |
InLeaveRecord
Gets if LeaveRecord(Boolean) was called. Will be set to False when LeaveRecord(Boolean) returns.
Declaration
public bool InLeaveRecord { get; }
Property Value
Type |
---|
System.Boolean |
InNavigate
True while processing Navigate(Int32) call. Will be set to False after Navigate(Int32) returns.
Declaration
public bool InNavigate { get; }
Property Value
Type |
---|
System.Boolean |
IsAnyPropertyInvalid
Checks if validation failed because of invalid data in the current record.
Declaration
public bool IsAnyPropertyInvalid { get; }
Property Value
Type |
---|
System.Boolean |
IsAnyPropertyModified
Determines if any field in the current record was modified.
Declaration
public bool IsAnyPropertyModified { get; }
Property Value
Type |
---|
System.Boolean |
IsEditing
Gets if BeginEdit() was called and is in editing mode. Will be set to False when CancelEdit() or EndEdit() is called.
Declaration
public bool IsEditing { get; }
Property Value
Type |
---|
System.Boolean |
IsLocked
Determines if current record is locked after a Lock() call.
Declaration
public bool IsLocked { get; }
Property Value
Type |
---|
System.Boolean |
IsModified
Determines if record was marked as modified.
Declaration
public bool IsModified { get; }
Property Value
Type |
---|
System.Boolean |
ParentTable
The Table this object belongs to.
Declaration
public Table ParentTable { get; set; }
Property Value
Type |
---|
Table |
Properties
Gets the collection of CurrentRecordProperty elements that contain modified values of the current record.
Declaration
public CurrentRecordPropertyCollection Properties { get; }
Property Value
Type |
---|
CurrentRecordPropertyCollection |
UpdateHelper
Gets or sets the record update helper.
Declaration
public IRecordUpdateHelper UpdateHelper { get; set; }
Property Value
Type |
---|
Syncfusion.Grouping.IRecordUpdateHelper |
Methods
AddNew()
Navigates to the AddNewRecord and calls BeginEdit().
Declaration
public void AddNew()
BeginEdit()
Switches the current record into edit mode. Raises CurrentRecordContextChange events on the Table.
Declaration
public void BeginEdit()
CancelEdit()
Cancels editing for the current record. Changes in the current record are discarded. Raises CurrentRecordContextChange events on the Table.
Declaration
public void CancelEdit()
DeleteCurrentRecord()
Deletes the current record.
Declaration
public void DeleteCurrentRecord()
Dispose()
Disposes of the object.
Declaration
public void Dispose()
EndEdit()
Ends edit mode for the current record. If changes are detected, they will be saved to the underlying data source. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record EndEdit()
Returns
Type | Description |
---|---|
Record | Returns the record that was changed. Normally this is a reference to the current record. But if the current record is an AddNewRecord, a new record will be added to the table and instead of returning the AddNewRecord, a reference to the newly created record element is returned. |
EnterRecord(Element)
Activates a new record; if there is a current record the method will throw an exception. You first need to call LeaveRecord(Boolean) in such case. Raises CurrentRecordContextChange events on the Table.
Declaration
public void EnterRecord(Element record)
Parameters
Type | Name | Description |
---|---|---|
Element | record | The record to navigate to. |
LeaveRecord(Boolean)
Deactivates the current record; if current record is in editing mode EndEdit() is called and / or CancelEdit() if record could not be validated. Raises CurrentRecordContextChange events on the Table.
Declaration
public void LeaveRecord(bool cancelEditIfNotValid)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | cancelEditIfNotValid | True if any changes should be discarded if they do not meet validation constraints; False if record should not be deactivated if not valid. |
Lock()
Locks the current record. While locked, calls to Navigate, BeginEdit, EndEdit, or CancelEdit will be ignored.
Declaration
public void Lock()
Navigate(Record, Int32)
Navigates the record up or down from the given initial record, the current element should not be deactivated if not valid, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record Navigate(Record startRecord, int step)
Parameters
Type | Name | Description |
---|---|---|
Record | startRecord | The initial record to move off from. |
System.Int32 | step | The number of records to advance. Positive step will move the record down, negative steps will move the record up. |
Returns
Type | Description |
---|---|
Record | The current record after navigation. |
Navigate(Int32)
Navigates the record up or down, the current element should not be deactivated if not valid, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record Navigate(int step)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | step | The number of records to advance. Positive step will move the record down, negative steps will move the record up. |
Returns
Type | Description |
---|---|
Record | The current record after navigation. |
NavigateTo(Element)
Navigates to a specific element, the current element should not be deactivated if not valid, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Element NavigateTo(Element record)
Parameters
Type | Name | Description |
---|---|---|
Element | record | The element to navigate to. |
Returns
Type | Description |
---|---|
Element | The current element after navigation. |
NavigateTo(Element, Boolean)
Navigates to a specific element, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Element NavigateTo(Element record, bool cancelEditIfNotValid)
Parameters
Type | Name | Description |
---|---|---|
Element | record | The element to navigate to. |
System.Boolean | cancelEditIfNotValid | True if any changes should be discarded if they do not meet validation constraints; False if record should not be deactivated if not valid. |
Returns
Type | Description |
---|---|
Element | The current element after navigation. |
NavigateTo(Element, Boolean, Boolean)
Navigates to a specific element. Raises CurrentRecordContextChange events on the Table.
Declaration
public Element NavigateTo(Element record, bool cancelEditIfNotValid, bool scrollInView)
Parameters
Type | Name | Description |
---|---|---|
Element | record | The element to navigate to. |
System.Boolean | cancelEditIfNotValid | True if any changes should be discarded if they do not meet validation constraints; False if record should not be deactivated if not valid. |
System.Boolean | scrollInView | True if record should be scrolled into view. |
Returns
Type | Description |
---|---|
Element | The current element after navigation. |
NavigateTo(Record)
Navigates to a specific record, the current element should not be deactivated if not valid, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record NavigateTo(Record record)
Parameters
Type | Name | Description |
---|---|---|
Record | record | The record to navigate to. |
Returns
Type | Description |
---|---|
Record | The current record after navigation. |
NavigateTo(Record, Boolean)
Navigates to a specific record, the current element should not be deactivated if not valid, element should be scrolled into view. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record NavigateTo(Record record, bool cancelEditIfNotValid)
Parameters
Type | Name | Description |
---|---|---|
Record | record | The record to navigate to. |
System.Boolean | cancelEditIfNotValid | True if any changes should be discarded if they do not meet validation constraints; False if record should not be deactivated if not valid. |
Returns
Type | Description |
---|---|
Record | The current record after navigation. |
NavigateTo(Record, Boolean, Boolean)
Navigates to a specific record. Raises CurrentRecordContextChange events on the Table.
Declaration
public Record NavigateTo(Record record, bool cancelEditIfNotValid, bool scrollInView)
Parameters
Type | Name | Description |
---|---|---|
Record | record | The record to navigate to. |
System.Boolean | cancelEditIfNotValid | True if any changes should be discarded if they do not meet validation constraints; False if record should not be deactivated if not valid. |
System.Boolean | scrollInView | True if record should be scrolled into view. |
Returns
Type | Description |
---|---|
Record | The current record after navigation. |
NotifyCurrentRecordListChanged(TableListChangedEventArgs)
Invoked when the underlying datasource, to which the current record belongs, is changed.
Declaration
public void NotifyCurrentRecordListChanged(TableListChangedEventArgs te)
Parameters
Type | Name | Description |
---|---|---|
TableListChangedEventArgs | te | The TableListChangedEventArgs object. |
Reinitialize()
Cancels editing for the current record; CancelEdit() is called, events are raised, and current record is marked as deactivated without raising events.
Declaration
public void Reinitialize()
Reinititalize()
Cancels editing for the current record; CancelEdit() is called, events are raised, and current record is marked as deactivated without raising events.
Declaration
[Obsolete("Use Reinitialize method instead")]
public void Reinititalize()
Reset()
Resets the current record state and raises a CurrentRecordManagerReset event on the parent table.
Declaration
public void Reset()
ResetCachedState()
Internal only.
Declaration
public void ResetCachedState()
ResetCurrentRecord(Record)
Resets the current record state and raises a CurrentRecordManagerReset event on the parent table. Afterwards it internally sets the CurrentElement without raising any events. This is an internal helper method that is called from Table when AddNewRecord has been transformed into a regular Record element when EndEdit was called.
Declaration
public void ResetCurrentRecord(Record record)
Parameters
Type | Name | Description |
---|---|---|
Record | record | The Record |
ResetModifiedValue(FieldDescriptor)
Resets the ModifiedValue for the specified CurrentRecordProperty. Works also with nested properties and related fields.
Declaration
public void ResetModifiedValue(FieldDescriptor fieldDescriptor)
Parameters
Type | Name | Description |
---|---|---|
FieldDescriptor | fieldDescriptor | The FieldDescriptor |
ShouldScrollInView()
Gets if element should be scrolled into view during a ShouldScrollInView() call.
Declaration
public bool ShouldScrollInView()
Returns
Type | Description |
---|---|
System.Boolean | True if the element should be scrolled into view. |
ToString()
Returns string representation of the current record manager.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of the current object. |
Overrides
Unlock()
Unlocks the current record after a Lock() call.
Declaration
public void Unlock()