Table of Contents

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

bool

ConfigAction

public ConfigAction ConfigAction { get; }

Property Value

ConfigAction

CurrentExportConfig

public ExportOptions CurrentExportConfig { get; set; }

Property Value

ExportOptions

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

int

CurrentSettings

public GridSettings CurrentSettings { get; set; }

Property Value

GridSettings

DataExportation

public JJDataExportation DataExportation { get; }

Property Value

JJDataExportation

DataSource

public List<Dictionary<string, object?>>? DataSource { get; set; }

Property Value

List<Dictionary<string, object>>

DeleteAction

public DeleteAction DeleteAction { get; }

Property Value

DeleteAction

EditAction

public EditAction EditAction { get; }

Property Value

EditAction

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

string

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

bool

EnableFilter

public bool EnableFilter { get; set; }

Property Value

bool

EnableMultiSelect

public bool EnableMultiSelect { get; set; }

Property Value

bool

EnableSorting

public bool EnableSorting { get; set; }

Property Value

bool

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

Dictionary<string, string>

ExportAction

public ExportAction ExportAction { get; }

Property Value

ExportAction

FilterAction

public FilterAction FilterAction { get; }

Property Value

FilterAction

FormElement

public FormElement FormElement { get; set; }

Property Value

FormElement

GridTableActions

public GridTableActionList GridTableActions { get; }

Property Value

GridTableActionList

ImportAction

public ImportAction ImportAction { get; }

Property Value

ImportAction

InsertAction

public InsertAction InsertAction { get; }

Property Value

InsertAction

LegendAction

public LegendAction LegendAction { get; }

Property Value

LegendAction

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

bool

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

string

RefreshAction

public RefreshAction RefreshAction { get; }

Property Value

RefreshAction

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

Dictionary<string, object>

Remarks

Key = Field name, Value=Field value

RouteContext

protected RouteContext RouteContext { get; }

Property Value

RouteContext

ShowHeaderWhenEmpty

Show the header when no records are found.

public bool ShowHeaderWhenEmpty { get; set; }

Property Value

bool

ShowPaging

Display pagination controls (Default = true)

public bool ShowPaging { get; set; }

Property Value

bool

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

bool

ShowToolbar

public bool ShowToolbar { get; set; }

Property Value

bool

SortAction

public SortAction SortAction { get; }

Property Value

SortAction

TitleActions

public List<TitleAction>? TitleActions { get; set; }

Property Value

List<TitleAction>

TitleSize

public HeadingSize TitleSize { get; set; }

Property Value

HeadingSize

ToolbarActions

public GridToolbarActionList ToolbarActions { get; }

Property Value

GridToolbarActionList

TotalOfRecords

public int TotalOfRecords { get; set; }

Property Value

int

ViewAction

public ViewAction ViewAction { get; }

Property Value

ViewAction

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

Task<ComponentResult>

ClearSelectedGridValues()

public void ClearSelectedGridValues()

ExportFileInBackground()

public ValueTask ExportFileInBackground()

Returns

ValueTask

GetActionContext(BasicAction, FormStateData)

public ActionContext GetActionContext(BasicAction basicAction, FormStateData formStateData)

Parameters

basicAction BasicAction
formStateData FormStateData

Returns

ActionContext

GetCurrentFilterAsync()

public ValueTask<Dictionary<string, object?>> GetCurrentFilterAsync()

Returns

ValueTask<Dictionary<string, object>>

GetDictionaryListAsync()

public Task<IList<Dictionary<string, object?>>?> GetDictionaryListAsync()

Returns

Task<IList<Dictionary<string, object>>>

GetFilterHtmlAsync()

public ValueTask<HtmlBuilder> GetFilterHtmlAsync()

Returns

ValueTask<HtmlBuilder>

GetGridAction(string)

public BasicAction GetGridAction(string actionName)

Parameters

actionName string

Returns

BasicAction

GetGridValuesAsync(IList<Dictionary<string, object?>>?)

public Task<List<Dictionary<string, object?>>?> GetGridValuesAsync(IList<Dictionary<string, object?>>? loadedData = null)

Parameters

loadedData IList<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

recordsPerPage int
currentPage int

Returns

Task<List<Dictionary<string, object>>>

Remarks

Used with the EnableEditMode property

GetSelectedGridValues()

public List<Dictionary<string, object>> GetSelectedGridValues()

Returns

List<Dictionary<string, object>>

Remarks

Used with the EnableMultiSelect property

GetSelectedRowId()

public Dictionary<string, object> GetSelectedRowId()

Returns

Dictionary<string, object>

GetTableHtmlAsync()

public Task<string> GetTableHtmlAsync()

Returns

Task<string>

GetTitleHtml()

public string GetTitleHtml()

Returns

string

GetToolBarAction(string)

public BasicAction GetToolBarAction(string actionName)

Parameters

actionName string

Returns

BasicAction

GetToolbarHtmlAsync()

public ValueTask<HtmlBuilder> GetToolbarHtmlAsync()

Returns

ValueTask<HtmlBuilder>

IsExportPost()

public bool IsExportPost()

Returns

bool

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

key string
value object

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

AsyncEventHandler<GridRenderEventArgs>

OnBeforeTableRenderAsync

public event AsyncEventHandler<GridRenderEventArgs>? OnBeforeTableRenderAsync

Event Type

AsyncEventHandler<GridRenderEventArgs>

OnDataLoadAsync

Event fired to retrieve table data

public event GridDataLoadEventHandler? OnDataLoadAsync

Event Type

GridDataLoadEventHandler

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

AsyncEventHandler<GridFilterLoadEventArgs>

OnRenderActionAsync

public event AsyncEventHandler<ActionEventArgs>? OnRenderActionAsync

Event Type

AsyncEventHandler<ActionEventArgs>

OnRenderCellAsync

public event AsyncEventHandler<GridCellEventArgs>? OnRenderCellAsync

Event Type

AsyncEventHandler<GridCellEventArgs>

OnRenderRowAsync

public event AsyncEventHandler<GridRowEventArgs>? OnRenderRowAsync

Event Type

AsyncEventHandler<GridRowEventArgs>

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

AsyncEventHandler<GridSelectedCellEventArgs>

OnRenderToolbarActionAsync

public event AsyncEventHandler<GridToolbarActionEventArgs>? OnRenderToolbarActionAsync

Event Type

AsyncEventHandler<GridToolbarActionEventArgs>