Class JJGridView
- Namespace
- JJMasterData.Core.UI.Components
- Assembly
- JJMasterData.Core.dll
Display the database values in a table, where each field represents a column and each record represents a row. Allows pagination, multiple filters, layout configuration and field sorting
public class JJGridView : AsyncComponent
- Inheritance
-
JJGridView
- Inherited Members
Examples
Example
Properties
AutoReloadFormFields
When reloading the panel, keep the values entered in the form. Valid only when EnableEditMode property is enabled (Default=True)
public bool AutoReloadFormFields { get; set; }
Property Value
ConfigAction
public ConfigAction ConfigAction { get; }
Property Value
CurrentExportConfig
public ExportOptions CurrentExportConfig { get; set; }
Property Value
CurrentOrder
Retrieve the order of the table, by default uses the first field of the primary key
public OrderByData CurrentOrder { get; set; }
Property Value
- OrderByData
Current table order
Remarks
For more than one field use comma ex: "Field1 ASC, Field2 DESC, Field3 ASC"
CurrentPage
public int CurrentPage { get; set; }
Property Value
CurrentSettings
public GridSettings CurrentSettings { get; set; }
Property Value
DataExportation
public JJDataExportation DataExportation { get; }
Property Value
DataSource
public List<Dictionary<string, object?>>? DataSource { get; set; }
Property Value
DeleteAction
public DeleteAction DeleteAction { get; }
Property Value
EditAction
public EditAction EditAction { get; }
Property Value
EmptyDataText
Gets or sets the text to be displayed on the empty data row when a JJGridView control contains no records.
public string? EmptyDataText { get; set; }
Property Value
Remarks
Default value = (There is no record to be displayed).
To hide the columns when displaying the message see the method ShowHeaderWhenEmpty.EnableEditMode
public bool EnableEditMode { get; set; }
Property Value
EnableFilter
public bool EnableFilter { get; set; }
Property Value
EnableMultiSelect
public bool EnableMultiSelect { get; set; }
Property Value
EnableSorting
public bool EnableSorting { get; set; }
Property Value
Remarks
Even when set to false, the grid respects the CurrentOrder property
Errors
Key-Value pairs with the errors.
public Dictionary<string, string> Errors { get; }
Property Value
ExportAction
public ExportAction ExportAction { get; }
Property Value
FilterAction
public FilterAction FilterAction { get; }
Property Value
FormElement
public FormElement FormElement { get; set; }
Property Value
GridTableActions
public GridTableActionList GridTableActions { get; }
Property Value
ImportAction
public ImportAction ImportAction { get; }
Property Value
InsertAction
public InsertAction InsertAction { get; }
Property Value
LegendAction
public LegendAction LegendAction { get; }
Property Value
MaintainValuesOnLoad
Keep the grid filters, order and pagination in the session, and recover on the first page load. (Default = false)
public bool MaintainValuesOnLoad { get; set; }
Property Value
Remarks
When using this property, we recommend changing the object's [Name] parameter. The [Name] property is used to compose the name of the session variable.
ParentComponentName
public string? ParentComponentName { get; set; }
Property Value
RefreshAction
public RefreshAction RefreshAction { get; }
Property Value
RelationValues
Values to be replaced by relationship. If the field name exists in the relationship, the value will be replaced
public Dictionary<string, object> RelationValues { get; set; }
Property Value
Remarks
Key = Field name, Value=Field value
RouteContext
protected RouteContext RouteContext { get; }
Property Value
ShowHeaderWhenEmpty
Show the header when no records are found.
public bool ShowHeaderWhenEmpty { get; set; }
Property Value
ShowPaging
Display pagination controls (Default = true)
public bool ShowPaging { get; set; }
Property Value
Remarks
Hide all pagination buttons but keep the default pagination controls.
The Pagination will be displayed if the number of grid records exceeds the minimum number of records on a page. If the CurrentPage property is equal to zero, pagination will not be displayed. If the CurrentUI.RecordsPerPage property is equal to zero, pagination will not be displayed. If the TotalRecords property is equal to zero, pagination will not be displayed.ShowTitle
public bool ShowTitle { get; set; }
Property Value
ShowToolbar
public bool ShowToolbar { get; set; }
Property Value
SortAction
public SortAction SortAction { get; }
Property Value
TitleActions
public List<TitleAction>? TitleActions { get; set; }
Property Value
TitleSize
public HeadingSize TitleSize { get; set; }
Property Value
ToolbarActions
public GridToolbarActionList ToolbarActions { get; }
Property Value
TotalOfRecords
public int TotalOfRecords { get; set; }
Property Value
ViewAction
public ViewAction ViewAction { get; }
Property Value
Methods
AddGridAction(InternalAction)
public void AddGridAction(InternalAction action)
Parameters
action
InternalAction
AddGridAction(ScriptAction)
public void AddGridAction(ScriptAction action)
Parameters
action
ScriptAction
AddGridAction(SqlCommandAction)
public void AddGridAction(SqlCommandAction action)
Parameters
action
SqlCommandAction
AddGridAction(UrlRedirectAction)
public void AddGridAction(UrlRedirectAction action)
Parameters
action
UrlRedirectAction
AddToolbarAction(InternalAction)
public void AddToolbarAction(InternalAction action)
Parameters
action
InternalAction
AddToolbarAction(ScriptAction)
public void AddToolbarAction(ScriptAction action)
Parameters
action
ScriptAction
AddToolbarAction(SqlCommandAction)
public void AddToolbarAction(SqlCommandAction action)
Parameters
action
SqlCommandAction
AddToolbarAction(SubmitAction)
public void AddToolbarAction(SubmitAction action)
Parameters
action
SubmitAction
AddToolbarAction(UrlRedirectAction)
public void AddToolbarAction(UrlRedirectAction action)
Parameters
action
UrlRedirectAction
BuildResultAsync()
protected override Task<ComponentResult> BuildResultAsync()
Returns
ClearSelectedGridValues()
public void ClearSelectedGridValues()
ExportFileInBackground()
public ValueTask ExportFileInBackground()
Returns
GetActionContext(BasicAction, FormStateData)
public ActionContext GetActionContext(BasicAction basicAction, FormStateData formStateData)
Parameters
basicAction
BasicActionformStateData
FormStateData
Returns
GetCurrentFilterAsync()
public ValueTask<Dictionary<string, object?>> GetCurrentFilterAsync()
Returns
GetDictionaryListAsync()
public Task<List<Dictionary<string, object?>>?> GetDictionaryListAsync()
Returns
- Task<List<Dictionary<string, object>>>
GetFilterHtmlAsync()
public ValueTask<HtmlBuilder> GetFilterHtmlAsync()
Returns
GetGridAction(string)
public BasicAction GetGridAction(string actionName)
Parameters
actionName
string
Returns
GetGridValuesAsync(List<Dictionary<string, object?>>?)
public Task<List<Dictionary<string, object?>>?> GetGridValuesAsync(List<Dictionary<string, object?>>? loadedData = null)
Parameters
loadedData
List<Dictionary<string, object>>
Returns
- Task<List<Dictionary<string, object>>>
Remarks
Used with the EnableEditMode property
GetGridValuesAsync(int, int)
public Task<List<Dictionary<string, object?>>?> GetGridValuesAsync(int recordsPerPage, int currentPage)
Parameters
Returns
- Task<List<Dictionary<string, object>>>
Remarks
Used with the EnableEditMode property
GetSelectedGridValues()
public List<Dictionary<string, object>> GetSelectedGridValues()
Returns
Remarks
Used with the EnableMultiSelect property
GetSelectedRowId()
public Dictionary<string, object> GetSelectedRowId()
Returns
GetTableHtmlAsync()
public Task<string> GetTableHtmlAsync()
Returns
GetTitleHtml()
public string GetTitleHtml()
Returns
GetToolBarAction(string)
public BasicAction GetToolBarAction(string actionName)
Parameters
actionName
string
Returns
GetToolbarHtmlAsync()
public ValueTask<HtmlBuilder> GetToolbarHtmlAsync()
Returns
IsExportPost()
public bool IsExportPost()
Returns
RemoveGridAction(string)
Remove custom button from grid.
public void RemoveGridAction(string actionName)
Parameters
actionName
string
Remarks
Only actions of types ScriptAction, UrlRedirectAction or InternalAction can be removed
RemoveToolBarAction(string)
Remove a custom button in the grid.
public void RemoveToolBarAction(string actionName)
Parameters
actionName
string
Remarks
Only actions of types ScriptAction, UrlRedirectAction or InternalAction can be removed
SetCurrentFilter(string, object)
public void SetCurrentFilter(string key, object value)
Parameters
SetGridOptions(GridUI)
public void SetGridOptions(GridUI options)
Parameters
options
GridUI
ValidateGridFields(List<Dictionary<string, object?>>)
Validate the field and returns a Hashtable with the errors.
public Dictionary<string, string> ValidateGridFields(List<Dictionary<string, object?>> values)
Parameters
values
List<Dictionary<string, object>>
Returns
- Dictionary<string, string>
Key = Field name Value = Message
Events
OnAfterTableRenderAsync
public event AsyncEventHandler<GridRenderEventArgs>? OnAfterTableRenderAsync
Event Type
OnBeforeTableRenderAsync
public event AsyncEventHandler<GridRenderEventArgs>? OnBeforeTableRenderAsync
Event Type
OnDataLoadAsync
Event fired to retrieve table data
public event GridDataLoadEventHandler? OnDataLoadAsync
Event Type
Remarks
The component uses the following rule to retrieve grid data:
1) Use the DataSource property; 2) If the DataSource property is null, try to execute the OnDataLoad action; 3) If the OnDataLoad action is not implemented, try to retrieve using the proc informed in the FormElement;OnFilterLoadAsync
public event AsyncEventHandler<GridFilterLoadEventArgs>? OnFilterLoadAsync
Event Type
OnRenderActionAsync
public event AsyncEventHandler<ActionEventArgs>? OnRenderActionAsync
Event Type
OnRenderCellAsync
public event AsyncEventHandler<GridCellEventArgs>? OnRenderCellAsync
Event Type
OnRenderRowAsync
public event AsyncEventHandler<GridRowEventArgs>? OnRenderRowAsync
Event Type
OnRenderSelectedCellAsync
Event fired when rendering the checkbox used to select the Grid row.
Fired only when EnableMultiSelect property is enabled.public event AsyncEventHandler<GridSelectedCellEventArgs>? OnRenderSelectedCellAsync
Event Type
OnRenderToolbarActionAsync
public event AsyncEventHandler<GridToolbarActionEventArgs>? OnRenderToolbarActionAsync