I noticed that AutoResizeRows is considering the columns with visible=false. Is this a bug or I did something wrong?
Questions:
Thanks for the modified sample. You are a very good teacher. And a quick one!
Thanks for the sample. See attached. And sorry for the wrong patch, these are the issues (some unrelated to the autosizing of the rows):
The attached adjusted sample includes the latest fix (is in the dev. build) so you can also see how to include bundled js with your app.
Video:
https://drive.google.com/file/d/1Q94V4deU14D2_BKEEch3ONuxq55IMCCV/view
I attached a small project, maibe it will be easier to tell what I’m doing wrong. You’ll have to add nugget Newtonsoft.Json because I can’t upload more than 3.9M…
Thank you,
Adrian
Still not seems to work in 2.1.78
Can you give me a working sample of a filled datagrid that adapt row height (and wrap content) by code?
Thank you,
Adrian
Hi Adrian,
it´s fixed in Wisej development build 2.1.78 that has just been released.
Best regards
Frank
Try the attached patch. Put in /Platforms or /Resources and set to Embedded Resource in AssemblyInfo uncomment the WisejResource attribute.
There is a regression in the javascript. Will fix in a dev build. I’m not sure I can have a patch before then.
I tried on 2.1.77. You have here a sample of code. Until 2.1.76 (included) that code works weird because of (sometimes big) not visible columns. Now it’s not working at all. I mean, nothing happens when I run that code with wrapText true/false.
Can you give me a working sample of a filled datagrid that adapt row height (and wrap content) by code?
Thank you,
Adrian
public static void AutoSizeTable(ref DataGridView dg, autoSizeTableMode tip, bool? wrapText = false)
{
try
{
var ds = dg.DataSource;
dg.DataSource = null;
switch (tip)
{
//bla-bla…
case autoSizeTableMode.Equal://user defined mode
for (int i = 0,nr_visible=0; i < dg.ColumnCount; i++,nr_visible+=((dg.Columns[i].Visible)?1:0));
for (int i = 0; i < dg.ColumnCount; i++)
dg.Columns[i].Width = dg.Width / nr_visible;
break;
//bla-bla…
default:
break;
}
if (wrapText != null)
for (int i = 0; i < dg.ColumnCount; i++)
dg.Columns[i].DefaultCellStyle.WrapMode = ((bool)wrapText ? DataGridViewTriState.True : DataGridViewTriState.False);
dg.DataSource = ds;
if (wrapText != null) dg.AutoResizeRows();
}
catch (Exception ex)
{
//bla-bla…
}
}
Hi Adrian,
issue #2324 is fixed in Wisej release 2.1.77
Best regards
Frank
Hi Adrian,
Thanks for reporting. It’s a bug! I’ve logged it as #2324 and a fix will be available in the next build!
Best,
Levie
Please login first to submit.