Comments (6)
Hi @kpenigar. Thanks for your donation! Could you please provide more details about your issue?
I understand that you want to display checkboxes in all cells of a specific column. Your approach is on the right track. After setting DefaultCellBody
to use checkboxes, you should assign a boolean value (true
or false
) to each cell in the column. Here's an example:
int dataCount = 10; // Number of rows
for (int i = 0; i < dataCount; i++)
{
sheet[i, 0] = false; // Assigns false to each cell in the first column
}
This code will populate the first column with unchecked checkboxes for the first 10 rows. Please adjust dataCount based on the actual number of rows in your sheet.
from reogrid.
Thanks for the quick response.
Context: I pull data from a database into the spreadsheet and then configure the spreadsheet, so I don't assign the default body style until all the data is loaded. The "IsOpen" field has a data type of Bit (0, 1).
from reogrid.
Did my answer resolve your question? Given your context, here is another example:
// Assuming `sheet` is the current worksheet and data is loaded
int columnIndexOfIsOpen = [Column Index of IsOpen]; // Replace with actual column index
for (int i = 0; i < sheet.RowCount; i++)
{
object dbValue = sheet[i, columnIndexOfIsOpen]; // Get value from cell
bool checkboxValue = Convert.ToBoolean(dbValue); // Convert DB Bit value to boolean
sheet[i, columnIndexOfIsOpen] = checkboxValue; // Assign boolean value to cell
// Optionally, set the cell body to CheckBoxCell if not already done
sheet.SetCellBody(i, columnIndexOfIsOpen, new CheckBoxCell());
}
In this example you don't have to use Header.DefaultCellBody
field, just set each checkbox into cells manually.
from reogrid.
Ok, I'll try to implement your suggestion and let you know.
Thanks again for your help.
from reogrid.
Yes, when you use Header.DefaultCellBody
, you don't have to set checkbox instances. Instead, if you set a boolean value to true
or false
, ReoGrid will automatically create the checkbox instance for you. Both methods achieve the same result.
from reogrid.
So I guess it probably would be more efficient if I did the data conversion on the server side, that way when the data's loaded it's already in the right format.
from reogrid.
Related Issues (20)
- datetime not show time
- Named Range is not displayed in the address bar after 100 columns (column CV)
- An exception occurred during the undo operation
- How to display full text beyond cell limits? HOT 9
- While loading a particualr Excel sheet, in the ReoGrid.Load Function exceptoin is thrown
- how to get cell with column or row header text?
- How to extract the exact value?
- How to add a column to the left of the Column Header, How to add rows on the RowHeader HOT 1
- Context menus on ReoGrid WPF
- WinUI 3 Support
- performance issue HOT 3
- How to adjust column order by dragging and dropping columns HOT 2
- dropdownlist item missing while save/load rgf file
- Does ReoGrid have function to show cell note?
- Getting Error - Exception thrown: 'System.ArgumentOutOfRangeException' in unvell.ReoGrid.dll HOT 5
- Hello, just want to ask...
- data exception HOT 1
- CSV file loading issue HOT 1
- Are there any plans to support Avalonia? HOT 2
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 reogrid.