Comments (1)
The selected checkboxes are configured in the following ways:
- checkboxes in the current page: with the GridComponent.Checkboxes property
- global settings for all checkboxes in the all pages: with the GridComponent.ExceptCheckedRows property and with the IsCheched() method of the header component object.
These 2 mechanisms are implemented and configured by the GridBlazor component at the same time because their purpose is different, but complementary.
GridComponent.Checkboxes.Get("columnName") dictionary includes the checked boxes of the current page using the the row id of the page, starting by 0 for the first row, as key. Each time that the page is rendered this dictionary is initialized and each checkbox value is setted as follows using the global settings:
bool _value = false;
// init value when header checkbox is enabled and is not null
var header = GridComponent.HeaderComponents.Get(_columnName);
var exceptCheckedRows = GridComponent.ExceptCheckedRows.Get(_columnName);
var keys = GridComponent.Grid.GetPrimaryKeyValues(Item);
string stringKeys = string.Join('_', keys);
if (exceptCheckedRows != null && !string.IsNullOrWhiteSpace(stringKeys) && exceptCheckedRows.ContainsKey(stringKeys))
_value = exceptCheckedRows.Get(stringKeys);
else if (header != null && header.IsChecked().HasValue)
_value = header.IsChecked().Value;
As you can see the checkbox value is false by default.
Then if GridComponent.ExceptCheckedRows dictionary contains the row key, the value is the one on the dictionary.
If GridComponent.ExceptCheckedRows dictionary doesn't contain the row key but the header IsChecked returns a non null value, the checkbox value is this one.
If you want to get the checked rows value you can follow one of the following approaches:
- disable paging to get all rows on the grid and use GridComponent.Checkboxes property to get the checked rows
- enable paging and use ExceptCheckedRows and HeaderComponents properties to get the checked columns in the same described before.
from grid.blazor.
Related Issues (20)
- CheckBox Check all HOT 1
- 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
- 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
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.