This is a migrated thread and some comments may be shown as answers.

WorkbookContentChanged event issue?

10 Answers 90 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Veteran
Anthony asked on 14 Jul 2014, 01:06 AM
Hi,

I am using the RadSpreadsheet to manipulate a workbook which I exported and stored in a database.

Once imported back from the database I allow the user to modify the workbook. I am detecting when the user makes a change to the content using the WorkbookContentChanged event. If a change is detected I enable my apps save button to allow the user to save the workbook back to the database.

My issue occurs when I try to do things such as rename a worksheet or freeze panes. The WorkbookContentChanged event is not fired and therefore the user will not be given the option by my app to save the workbook back to the database.

Is there another event I can hook up to or is this a bug with the WorkbookContentChanged not firing for some changes?

Thanks
Anthony

10 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay Demirev
Telerik team
answered on 14 Jul 2014, 11:54 AM
Hi Anthiny,

Than you for reporting this issue. We have managed to fix it and the fix will be available for download with the LIB that will be released next week.

You can use the WorkbookContentChnaged event for all changes that are applied on the workbook. As Freeze Panes is considered as UI feature, the WorkbookContentChange do not respect it. To be able to track Freeze Panes changes we have introduced FreezePanesChanged event. Here is a code snippet showing how you can use it:
this.radSpreadsheet.ActiveSheetEditorChanged += this.RadSpreadsheet_ActiveSheetEditorChanged;
 
RadWorksheetEditor worksheetEditor;
private void RadSpreadsheet_ActiveSheetEditorChanged(object sender, EventArgs e)
{
    if (this.worksheetEditor != null)
    {
        this.worksheetEditor.ActivePresenterChanged -= this.WorksheetEditor_ActivePresenterChanged;
    }
 
    this.worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor;
 
    if (this.worksheetEditor != null)
    {
        this.worksheetEditor.ActivePresenterChanged += this.WorksheetEditor_ActivePresenterChanged;
    }
}
 
NormalWorksheetEditorPresenter activePresenter;
private void WorksheetEditor_ActivePresenterChanged(object sender, EventArgs e)
{
    if (this.activePresenter != null)
    {
        this.activePresenter.FreezePanesChanged -= this.ActivePresenter_FreezePanesChanged;
    }
 
    this.activePresenter = this.worksheetEditor.ActivePresenter as NormalWorksheetEditorPresenter;
 
    if (this.activePresenter != null)
    {
        this.activePresenter.FreezePanesChanged += this.ActivePresenter_FreezePanesChanged;
    }
}
 
private void ActivePresenter_FreezePanesChanged(object sender, EventArgs e)
{
}

As a token of our appreciation for reporting this I am updating your Telerik points.

Please, do not hesitate to let us know if you encounter any further issues regarding this or any other matter.


Regards,
Nikolay Demirev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Anthony
Top achievements
Rank 1
Veteran
answered on 17 Jul 2014, 05:20 AM
Hi,

Thanks for the reply.

I am also having the same issue with the zoom control on the RadSpreadsheetStatusBar. Is there any way to determine when the user changes the zoom level of the sheet?

Thanks
Anthony
0
Accepted
Nikolay Demirev
Telerik team
answered on 17 Jul 2014, 08:24 AM
Hi Anthony,

The RadWorksheetEditor exposes ScaleFactorChanged event. You can use it to track if the scale factor is changed. The change of the scale factor is also considered as UI feature and that is why the WorkbookContetnChanged event is not raised.

If you need any further assistance, please do not hesitate to contact us again.

Regards,
Nikolay Demirev
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Anthony
Top achievements
Rank 1
Veteran
answered on 19 Jul 2014, 02:03 AM
Thanks, that worked.

Anthony
0
Anthony
Top achievements
Rank 1
Veteran
answered on 31 Jul 2014, 11:18 PM
Hi,

I tested this with the latest build and it works as expected now.

Thanks
Anthony
0
Anthony
Top achievements
Rank 1
Veteran
answered on 05 Dec 2014, 04:25 AM
Hi,

This code was all working fine, however the ActivePresenterChanged event is now no longer firing.

Did something change in the latest release?

Thanks
Anthony
0
Anthony
Top achievements
Rank 1
Veteran
answered on 05 Dec 2014, 05:13 AM
Hi,

Just an update on what I have found with some more testing. It does fire on the first Active Sheet, but if you change to another sheet it no longer fires.

I am using the exact code from the answer above to handle the ActiveSheetEditorChanged event.

Thanks
Anthony
0
Nikolay Demirev
Telerik team
answered on 05 Dec 2014, 09:46 AM
Hi Anthony,

The active presenter is changed when the control initializes and when the RadWorksheetEditor which owns the presenter changes its owner. The editor never changes its owner and that is why the event is triggered only once after the initialization of the control.

Are you facing any issues related to this behaviour?

Regards,
Nikolay Demirev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Anthony
Top achievements
Rank 1
Veteran
answered on 05 Dec 2014, 11:43 AM
Hi Nikolay,

The issue is that once I move to a new worksheet I can no longer detect if the user Freezes Panes. The reason for this is seen in the code you initially supplied in this post. The FreezePanesChanged event is hooked up when the ActivePresenterChanged event is fired, which you have just pointed out only fires once, not after each worksheet change.

The ActivePresenter has definitely changed when the worksheet changes, so I believe this event should really be fired again, otherwise the event is incorrectly named and should be renamed to ActivePresenterChangedFirstTime.

I have managed to work around the issue by testing if the ActivePresenter has changed in the ActiveSheetEditorChanged event.

Thanks
Anthony

0
Nikolay Demirev
Telerik team
answered on 05 Dec 2014, 12:47 PM
Hi Anthony,

Indeed there was a bug which I have just fixed. The fix will be released with the next LIB, which will be available for download next week.

As a token of our appreciation for reporting this I am updating your Telerik points.

Regards,
Nikolay Demirev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Spreadsheet
Asked by
Anthony
Top achievements
Rank 1
Veteran
Answers by
Nikolay Demirev
Telerik team
Anthony
Top achievements
Rank 1
Veteran
Share this question
or