Editing
Since 0.1.0-alpha.24
The members for editing, and the types they use. Every member of
IzzyBlazor.TreeList<TItem> is on the TreeList API.
Properties (7)
NewChildFunc<TItem, TItem>?A new row's starting values under the row given, such as its parent's id set. Setting it lets an AddChildAction add rows under others; OnSave gets the row with IsNew set. NewItem still adds top rows, from the toolbar.
ItemMovableFunc<TItem, bool>?Which rows can be moved; all of them when it's not set. It's checked on a move too, not just when drawing the action.
MoveByDragbool = falseGives each row a handle to drag it before, after or into another row, never into its own branch. Needs OnReparent, which gets the row's new parent and place. A drop moves the row at once, on a static page by a form post. Pressed, or from the keyboard, the handle opens the Move dialog, as a MoveAction does, and so does a drop OnReparent turns down, with its reason.
NewItemFunc<TItem>?A new row's starting values. Setting it adds an Add button to the toolbar, and OnSave gets the row with IsNew set.
ItemEditableFunc<TItem, bool>?Which rows can be edited; all of them when it's not set. It's checked on a save too, not just when drawing the button.
ItemDeletableFunc<TItem, bool>?Which rows can be deleted; all of them when it's not set. It's checked on a delete too, not just when drawing the button.
Events (3)
OnReparentEventCallback<TreeListMove<TItem>>Saves a row moved under another, or to the top level, from a MoveAction's dialog. With no error added, the dialog closes and the rows load again. Needs Items.
OnSaveEventCallback<DataGridSave<TItem>>Saves an edited row. With no errors added, the editor closes and the rows load again; with errors, it stays open and shows them. It's called only when the row is valid by its rules.
OnDeleteEventCallback<DataGridDelete<TItem>>Deletes a row, once someone has confirmed it. Setting it adds a Delete action to each row. With no error added, the dialog closes and the rows load again.
Types (4)
DataGridDelete
classA delete from a DataGrid, for its OnDelete. With no error added, the dialog closes and the rows load again.
| Member | Description |
|---|---|
Item TItem | The row to delete. |
AddError(string message) | Reports why it can't be deleted, shown in the dialog, which stays open. |
DataGridEditMode
enumHow a DataGrid edits a row.
| Value | Description |
|---|---|
None | It doesn't. The default. |
Dialog | In a dialog, with a field for each editable column. |
Row | In the row, with a field in each editable column that's shown. A new row starts at the top of the page. Not with rows that load as they're needed, which could scroll it away. |
Cell | One cell at a time, on an interactive page: a click, Enter, F2 or typing starts it, and Tab, Enter or a click elsewhere saves it. |
DataGridSave
classA save from a DataGrid, for its OnSave. With no errors added, the editor closes and the rows load again. With errors, it stays open and shows them.
| Member | Description |
|---|---|
Item TItem | The row with its new values: a copy, and valid by its rules. Only editable columns have changed. |
Original TItem | The row as it was loaded, or the default for a new one. |
IsNew bool | Whether it's a new row, from |
AddError<TValue>(Expression<Func<TItem, TValue>> field, string message) | Reports a problem with the save as a whole, shown at the top of the editor. |
AddError(string message) | Reports a problem with the save as a whole, shown at the top of the editor. |
CopyTo(TItem target) | Copies the editable columns' new values to |
TreeListMove
classA row of a TreeList<T> moved under another, or to the top level, for its OnReparent to save: set the row's parent and its place among its new siblings. With an error added, the move doesn't happen and the dialog stays open with the message.
| Member | Description |
|---|---|
Item TItem | The row moved. |
Parent TItem | The row it goes under, or default for the top level. |
Index int | Where it goes among its new siblings, from 0: after them all, from the Move dialog. |
HasErrors bool | Whether an error was added, which stops the move. |
AddError(string message) | Stops the move and says why, in the dialog. |