Read only cells not sorted with the data in Grit Web

Hi,

Thanks for your feedback and providing us details.

We will further look into your issue and get back to you soon.

Thank you.

Hi,

Well, we handle the GridWeb’s OnPreRender event as shown in the following code. There are only “b2” and “b3” cells set to read-only after every sorting. Hopefully, it can suit your need accordingly now.

protected void GridWeb1_PreRender(object sender, EventArgs e)
{
string eventTarget = Request.Params["__EVENTTARGET"];
string eventArgument = Request.Params["__EVENTARGUMENT"];

if (eventTarget == “GridWeb1”)
{
string[] args = eventArgument.Split(new char[] { ‘:’ });
// Check if DataBind sort
if (args.Length > 0 && args[0] == “CELLCMD” && args[1].StartsWith("_BCSORT"))
{
// get sorting column index
string coli = args[1].Split(new char[] { ‘#’ })[1];
int colIndex = int.Parse(coli);

GridWeb1.WebWorksheets[0].Cells[“b2”].IsReadonly = true;
GridWeb1.WebWorksheets[0].Cells[“b3”].IsReadonly = true;
}
}
}

Thank you.

We have investigated this a little more and looks kind of odd on our end. The “pre render” event handler setting the cell’s ReadOnly property works 2 times. After 2 sorts on the client side, ALL cells are set as ‘read only’, even if our code sets ReadOnly=FALSE. All cells are then rendered with a ‘protected=true’ HTML attribute. 2st two sorts are always correct, it is after 2 client side sorts that things get out of sync. As I said, very odd. I had my code reviewed by a peer within my company and it is correct;we have stepped thru it and it only sets certain cells as ReadOnly=false, yet all cells end up read-only.

As I said we are getting a lot of pressure to resolve this issue; if you can look into this (try sorting multiple times on your end) we’d truly appreciate this.

Hi,

Could you give us a sample project to show the issue, we will check it soon.

Thank you.

Here you go. This project includes the latest gridweb DLL. But here is what I have noticed: it does not work with V5.1+ versions of the grid DLL, BUT IT WORKS fine with older ones. My GAC v4.8, (file v 2.0.2.2002) so a ref to the GAC version works, if I make a reference to a yet another pre v5 version on my hard drive, it works. But as soon as a reference anything that I have with a V5 or later (file V2.3.+ Sep 2010 file data or later, then the code does not work.

PS - The demo should keep the row with vendorid=1/First Vendor with an enabled checkbox

FYI: Latest Aspose.Cells.GridWeb v2.4.1.2004

<!–[if gte mso 10]> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>Hi,

We have fixed the issue in Aspose.Cells.GridWeb v2.4.1.2005 (attached). Your sample project works fine now. Please update the Aspose.Cells.GridWeb.dll file first, and then remove all files in /acw_client/ virtual directory, update it with /acw_client directory in the zip file.

Also, please remove the sample project as it contains a license file.

Thank you.

The sorting issue is solved, but now I get a 'firstChild.className is null or not an object" javascript runtime error from when I attempt to edit a text value. I modified the demo to allow editing of the text column and I can duplicate the error in my little test. just change the code in the loop at the end of prerender to set/clear IsReadOnly for the other cells in the row.:
string column2 = acgwHeader.WebWorksheets[0].Cells[row, 1].UnformattedStringValue;

if (column2 == “1”)
{
acgwHeader.WebWorksheets[0].Cells[row, 0].IsReadonly = false; // enable checkbox on item 1 only
acgwHeader.WebWorksheets[0].Cells[row, 1].IsReadonly = false; // enable checkbox on item 1 only
acgwHeader.WebWorksheets[0].Cells[row, 2].IsReadonly = false; // enable checkbox on item 1 only
}
else
{
acgwHeader.WebWorksheets[0].Cells[row, 0].IsReadonly = true;
acgwHeader.WebWorksheets[0].Cells[row, 1].IsReadonly = true;
acgwHeader.WebWorksheets[0].Cells[row, 2].IsReadonly = true;
}
Just try typing into the 2nd or 3d column of the raw which is NOT read only and you will get a runtime error shown in the attachment. I am running MS script debugger, so the specific source line/stack trace is shown there.


Hi Garrick,

Can you please test your case with latest version Aspose.Cells.GridWeb v2.4.2.2001 and let me know your findings. Thanks for your help.

Yes, it works. But it seems MUCH slower, both on the server side (binding to a List collection), as well as on the client side. We have some fairly largecollections (5,000-10,000 records) that we bind to the grid (using paging, of course) and the performance was marginally acceptable before, but now it is way too slow…

I have tried binding to datasets rather than lists and it is a just bit faster. . I have also determined that it is the worksheet.DataBind method that is slow. But what’s worse is that it is nonlinear - it takes approximately 30 seconds to bind to a an about 3000 row collection ( a bit faster if bound to a dataset), but for a 7500 row collection it takes 3 minutes 15 seconds (again a tad faster if binding to a data set rather than a collection). 8100 collection takes 3:50 (8% more data, 18% more time). Either way, it is just too slow…Your winform grid takes much less to bind to a much larger data set - I have bound 10000 (ten thousand) row data sets in a few seconds…

Further testing has revealed that it is not only the bind that is much slower. On the client side there is a 30+ second delay AFTER the grid is rendered on the page before I can use or do anything on the page. Client CPU is pegged at 100% per each processor (i.e. maxed out at 50% on a dual core CPU). This is with a 180 row grid (with no paging) that used to have at most a 1-2 second delay. Not sure what is going on there, or what client side script/code is running, but basically the page is completely unusable with large grids. There is a bit of a delay on other pages where we use paging, but with a page size of 20 or 50, it seems to be tolerable, but not so with larger grids.

Hi,

We have implemented a method name “ConvertDataTable” to convert a custom list to a DataTable object. Please try the following code with Aspose.Cells.GridWeb v2.4.2.2003(attached), this will enhance the performance on the server side.

DataTable table = CustomCollectionHelper.ConvertDataTable(list);
WebWorksheet sheet = GridWeb1.WebWorksheets[0];
sheet.DataSource = table;

Please update the Aspose.Cells.GridWeb.dll file first, and then remove all files in /acw_client/ virtual directory, update it with /acw_client directory in the zip file.
Please tell us how many rows/columns in your paging, which version of ie you are using. We will analyze the client side issue.

Thank you.

I’ll try the new DLL shortly, although I have previously tried binding to a DataSet rather than a collection and the speed improvement was negligible, perhaps a few seconds shaved off the 30+ seconds bind time.

As far as the browser, we are running IE7 or IE8 in compatibility mode. Can’t tell you about other browsers, we don’t support them. The grid size is not using pagingas we know that there is never any more than than 180-200 rows by 15 columns, so urs simply scroll through the list to avoid post-backs associated with paging. All but 3 columns are text; 1 is a dropdown, 2 are checkboxes. 2 columns contain have comments. The delay seems to be related to the number of rows. We use the WebGrid on other pages, but always in paged mode as we are generally working with much larger data sets; page size is variable between 20 and 50, with a page size of 20 I can’t tell if there is a delay, with a page size of 50 there is a slow down that we did not experience with the prior version of the grid.

Are there any news on speeding up the front end browser sluggishness issue?

Hi,

We have enhanced the performance of client scripts for IE in Aspose.Cells.GridWeb v2.4.2.2005 (attached). It takes a few seconds to load 1000*15 cells completely.

Please update the Aspose.Cells.GridWeb.dll file first, and then remove all files in /acw_client/ virtual directory, update it with /acw_client directory in the zip file.

thank you.


It works! It is much faster. There is a minor issue though - hyperlink cells do not appear to be sorted correct, all other cells/columns are sorting fine. See attachment. The vendor id is a bound field, with the vendor id hyperlink being the same as the cell content, i.e. VendorGroupId and VendorId collection members are also bound to, respectively, columns 1 and 2.

Code snippet below:

WebWorksheet wks = acgwHeader.WebWorksheets[0];
wks.Cells.Clear();
wks.EnableRowAddDelete = false;
wks.DataSource = histories; // histories is a collection that
wks.DataBind();

for (int row = 0; row < histories.Count; row++)
{

if (!string.IsNullOrEmpty(histories[row].VendorGroupId))
{
Hyperlink hlinkVendorGroup = wks.Hyperlinks.AddHyperlink(row, 1);
hlinkVendorGroup.ActionType = HyperlinkActionType.CellCommand;
hlinkVendorGroup.Text = string.IsNullOrEmpty(histories[row].VendorGroupId) ? “” : histories[row].VendorGroupId;
hlinkVendorGroup.ToolTip = string.IsNullOrEmpty(histories[row].VendorGroupId) ? “” : histories[row].VendorInfo + “\nClick to see files history”;
hlinkVendorGroup.DiscardInput = string.IsNullOrEmpty(histories[row].VendorGroupId);
}

Hyperlink hlinkVendorId = wks.Hyperlinks.AddHyperlink(row, 2);
hlinkVendorId.ActionType = HyperlinkActionType.CellCommand;
hlinkVendorId.Text = histories[row].VendorId;
hlinkVendorId.ToolTip = histories[row].VendorInfo + “\nClick to see files history”;
}

Hi,

We have fixed the bug of sorting hyperlinks in Aspose.Cells.GridWeb v2.4.2.2007 (attached). Kindly try it and let us know if it works fine now.

Please update the Aspose.Cells.GridWeb.dll file first, and then remove all files in /acw_client/ virtual directory, update it with /acw_client directory in the zip file.

Thank you.


Works great (and seems to be faster too)! I also noticed that you now seem to sort the cell read only attribute with the data, so it appears there is no need for the ‘OnPreRender’ handler to reset the cells; .IsReadOnly attribute? Please confirm is; I like this behaviour, but as your original answer was it is not quote the same as in Excel, hence I want to make sure that this will not change in your further releases

Thank you for your prompt fix!!!

Hi,

Thanks. The properties (readonly, hyperlinks, validations, styles and comments etc.) will be sorted with the relative cells. We will keep this behavior in further releases.

Thank you. This will save me quite a it of development time/coding!