Comments (1)
You can do it using the Width
property of the selected column.
The accepted values of the Width
property are strings with the units (e.g. "100px", "20em", etc.)
The following page allows you to change the size of the first column of the grid ("OrderID").
@page "/"
@using GridBlazorServerSide.ColumnCollections
@using GridBlazorServerSide.Models
@using GridBlazorServerSide.Resources
@using GridBlazorServerSide.Services
@using Microsoft.Extensions.Primitives
@using System.Globalization
@using System.Threading.Tasks
@inject IOrderService orderService
<h1>Grid Sample</h1>
<p>
This page contains a basic grid
</p>
<p>
This component demonstrates a GridBlazor server-side grid. For more information, please see: <a href="https://github.com/gustavnavar/Grid.Blazor">https://github.com/gustavnavar/Grid.Blazor</a>
</p>
@if (_task.IsCompleted)
{
<div class="row" style="margin-bottom:10px;">
<label class="control-label col-md-1"><b>Col widtj</b></label>
<div class="col-md-2">
<input class="form-control" @bind="_colWidth" @onkeyup="InputColWidthKeyup" @onclick:stopPropagation />
</div>
</div>
<div class="row">
<div class="col-md-12">
<GridComponent T="Order" Grid="@_grid"></GridComponent>
</div>
</div>
}
else
{
<p><em>Loading...</em></p>
}
@code
{
private CGrid<Order> _grid;
private Task _task;
private string _colWidth;
protected override async Task OnParametersSetAsync()
{
var locale = CultureInfo.CurrentCulture;
SharedResource.Culture = locale;
var columnCollections = new ColumnCollections();
var query = new QueryDictionary<StringValues>();
var client = new GridClient<Order>(q => orderService.GetOrdersGridRows(ColumnCollections.OrderColumns, q),
query, false, "ordersGrid", ColumnCollections.OrderColumns, locale)
.Sortable()
.Filterable()
.SetStriped(true)
.WithMultipleFilters()
.WithGridItemsCount();
_grid = client.Grid;
// Set new items to grid
_task = client.UpdateGrid();
await _task;
var column = ((ICGrid)_grid).Columns.SingleOrDefault(r => r.Name == "OrderID");
_colWidth = column.Width;
}
public void InputColWidthKeyup(KeyboardEventArgs e)
{
if (e.Key == "Enter")
{
var column = ((ICGrid)_grid).Columns.SingleOrDefault(r => r.Name == "OrderID");
column.Width = _colWidth;
}
}
}
from grid.blazor.
Related Issues (20)
- No data displayed when applying an "is null" filter on nullable text columns HOT 1
- Show message on empty SubGrid HOT 2
- GridHeaderComponent is null when I press apply button on a custom filter HOT 7
- Totals rounding HOT 2
- Totals System.AggregateException when using search HOT 2
- Checkboxes in GridComponent does not include all the rows when pagination is active HOT 1
- how to return additional data from controller using odata backend HOT 1
- File upload crushes in debug mode HOT 7
- How to sort the grid using an API rest as a data source HOT 1
- Did development stop on this component? HOT 1
- Error when table filter is invalid HOT 3
- Show selected filters [Blazor] HOT 1
- Bulgarian language inaccuracies HOT 1
- Request for adding localization languages. HOT 3
- ItemsToDisplay HOT 6
- Change cell background color depending on value. HOT 2
- Serialize ISGrid HOT 2
- SubGrid button bar is not displayed HOT 2
- Two errors in version 5.0.3 HOT 4
- .WithPaging - how can i make the parameter dynamically from user input on grid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grid.blazor.