Skip to content

Commit

Permalink
Configurable visibility of section ''Go To Page'' (gustavnavar/Grid.B…
Browse files Browse the repository at this point in the history
  • Loading branch information
rgentry09 committed May 4, 2023
1 parent 5486e5d commit 99778a8
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 12 deletions.
6 changes: 6 additions & 0 deletions GridBlazor/Client/GridClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ public IGridClient<T> WithPaging(int pageSize, int maxDisplayedItems, string que
return this;
}

public IGridClient<T> GoToVisibility(bool enable)
{
_source.Pager.GoToVisibility = enable;
return this;
}

public IGridClient<T> Virtualize()
{
return Virtualize(450);
Expand Down
6 changes: 6 additions & 0 deletions GridBlazor/Client/IGridClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public interface IGridClient<T>
/// <param name="queryStringParameterName">Query string parameter name</param>
IGridClient<T> WithPaging(int pageSize, int maxDisplayedItems, string queryStringParameterName);

/// <summary>
/// Enable go to pager visibility
/// </summary>
/// <param name="enable">Enable go to pager visibility</param>
IGridClient<T> GoToVisibility(bool enable);

/// <summary>
/// Enable virtualization
/// </summary>
Expand Down
7 changes: 5 additions & 2 deletions GridBlazor/Pages/GridPagerComponent.razor
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@
</ul>
</nav>

<div class="grid-goto-page form-group">
<label class="control-label"><b>@Strings.Goto</b></label>
@if (GridComponent.Grid.Pager.GoToVisibility)
{
<div class="grid-goto-page form-group">
<label class="control-label"><b>@Strings.Goto</b></label>
<div>
<input class="form-control grid-goto-page-input" @bind="_currentPage" @onkeyup="GoToKeyup" @onblur="GoToBlur" @onclick:stopPropagation />
</div>
</div>
}
}

@if (GridComponent.Grid.PagingType == PagingType.Pagination && GridComponent.Grid.Pager.ChangePageSize)
Expand Down
2 changes: 2 additions & 0 deletions GridBlazor/Pagination/GridPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public int PageSize

public bool ChangePageSize { get; set; }

public bool GoToVisibility { get; set; } = true;

public int QueryPageSize
{
get { return _queryPageSize; }
Expand Down
5 changes: 5 additions & 0 deletions GridBlazor/Pagination/IGridPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public interface IGridPager
/// </summary>
bool ChangePageSize { get; set; }

/// <summary>
/// Enable Go To field on view
/// </summary>
bool GoToVisibility { get; set; }

/// <summary>
/// Max grid items, displaying on the page configured on the view
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions GridCore/Pagination/GridPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public int PageSize

public bool ChangePageSize { get; set; }

public bool GoToVisibility { get; set; } = true;


public int QueryPageSize
{
get { return _queryPageSize; }
Expand Down
2 changes: 2 additions & 0 deletions GridCore/Pagination/IGridPager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public interface IGridPager
/// </summary>
bool ChangePageSize { get; set; }

bool GoToVisibility { get; set; }

/// <summary>
/// Max grid items, displaying on the page configured on the view
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions GridCore/Server/GridCoreServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public IGridServer<T> WithPaging(int pageSize, int maxDisplayedItems, string que
return this;
}

public IGridServer<T> GoToVisibility(bool enable)
{
_source.Pager.GoToVisibility = enable;
return this;
}

public IGridServer<T> Sortable()
{
return Sortable(true, GridSortMode.ThreeState);
Expand Down
6 changes: 6 additions & 0 deletions GridCore/Server/IGridServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public interface IGridServer<T>
/// <param name="queryStringParameterName">Query string parameter name</param>
IGridServer<T> WithPaging(int pageSize, int maxDisplayedItems, string queryStringParameterName);

/// <summary>
/// Enable go to pager visibility
/// </summary>
/// <param name="enable">Enable go to pager visibility</param>
IGridServer<T> GoToVisibility(bool enable);

/// <summary>
/// Enable sorting for all columns
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions GridMvc/Html/GridHtmlOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ public IGridHtmlOptions<T> WithPaging(int pageSize, int maxDisplayedItems, strin
return this;
}

public IGridHtmlOptions<T> GoToVisibility(bool enable)
{
_source.Pager.GoToVisibility = enable;
return this;
}

public IGridHtmlOptions<T> Sortable()
{
return Sortable(true, GridSortMode.ThreeState);
Expand Down
6 changes: 6 additions & 0 deletions GridMvc/Html/IGridHtmlOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public interface IGridHtmlOptions<T> : IHtmlContent
/// <param name="queryStringParameterName">Query string parameter name</param>
IGridHtmlOptions<T> WithPaging(int pageSize, int maxDisplayedItems, string queryStringParameterName);

/// <summary>
/// Enable go to pager visibility
/// </summary>
/// <param name="enable">Enable go to pager visibility</param>
IGridHtmlOptions<T> GoToVisibility(bool enable);

/// <summary>
/// Enable sorting for all columns
/// </summary>
Expand Down
13 changes: 8 additions & 5 deletions GridMvc/Views/Shared/_AjaxGridPager.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@
</ul>
</nav>

<div class="grid-goto-page form-group" data-goto-page-url="@_goToUrl">
<label class="control-label"><b>@Strings.Goto</b></label>
<div>
<input class="form-control grid-goto-page-input" value="@Model.CurrentPage" />
@if (Model.GoToVisibility)
{
<div class="grid-goto-page form-group" data-goto-page-url="@_goToUrl">
<label class="control-label"><b>@Strings.Goto</b></label>
<div>
<input class="form-control grid-goto-page-input" value="@Model.CurrentPage" />
</div>
</div>
</div>
}

@if (_pagingType == PagingType.Pagination && Model.ChangePageSize)
{
Expand Down
13 changes: 8 additions & 5 deletions GridMvc/Views/Shared/_GridPager.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,15 @@
</ul>
</nav>

<div class="grid-goto-page form-group" data-goto-page-url="@_goToUrl">
<label class="control-label"><b>@Strings.Goto</b></label>
<div>
<input class="form-control grid-goto-page-input" value="@Model.CurrentPage" />
@if (Model.GoToVisibility)
{
<div class="grid-goto-page form-group" data-goto-page-url="@_goToUrl">
<label class="control-label"><b>@Strings.Goto</b></label>
<div>
<input class="form-control grid-goto-page-input" value="@Model.CurrentPage" />
</div>
</div>
</div>
}

@if (_pagingType == PagingType.Pagination && Model.ChangePageSize)
{
Expand Down

0 comments on commit 99778a8

Please sign in to comment.