Hi,
I am trying to refresh the pivot table by periodically refresh its data source. It's certainly not the correct way to proceed... Can you please suggest.?
Expected Behavior:
After the timer call back is called, I am expecting the pivot table content automatically updated.
Many thanks,
Yi
Hi,
My requirement is to let users construct dynamically pivot table on a changing data updated in timely fashion.
Two questions here, please:
1/ In blazor server architecture, the your component loads all data to browser and it's up to javascript to build pivot table, or you build the pivoted result on server side, then send back to browser?
2/ purely for the mentioned feature, in terms of performance, do you recommend blazor server architecture or the one of web assembly? Please note that I have large dataset - 500k lines
Thanks!
Yi
Hi,
I updated my app that you can find in the attached zip file.
The app scales well to 20_000 lines.
It goes wrong with 200_000 lines, data refreshed every 5 seconds with initial wait of 5 seconds.
The applicaiton crashed at the very beginning:
```log
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Content root path: C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application
index page 52974372
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
There is no region associated with the Invariant Culture (Culture ID: 0x7F).
removed 16439
removed 9428
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Components.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.AspNetCore.Components.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.AspNetCore.Components.dll
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at System.Text.Json.Serialization.Converters.IEnumerableDefaultConverter`2.OnWriteResume(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryWrite(Utf8JsonWriter writer, TCollection value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.WriteCore(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteUsingSerializer[TValue](Utf8JsonWriter writer, TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.WriteStringUsingSerializer[TValue](TValue& value, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
at Syncfusion.Blazor.Internal.SfBaseUtils.Equals[T](T oldValue, T newValue)
at Syncfusion.Blazor.SfBaseComponent.NotifyPropertyChanges[T](String propertyName, T publicValue, T privateValue, Boolean updatePrevProps)
at Syncfusion.Blazor.SfBaseComponent.NotifyPropertyChanges[T](String propertyName, T publicValue, T privateValue)
at Syncfusion.Blazor.PivotView.PivotViewDataSourceSettings`1.ParametersSet()
at Syncfusion.Blazor.PivotView.PivotViewDataSourceSettings`1.OnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.HandleException(Exception exception)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.HandleExceptionViaErrorBoundary(Exception error, ComponentState errorSourceOrNull)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToPendingTasks(Task task, ComponentState owningComponentState)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView parameters)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.HandleException(Exception exception)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessPendingRender()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToRenderQueue(Int32 componentId, RenderFragment renderFragment)
at Microsoft.AspNetCore.Components.ComponentBase.StateHasChanged()
at Microsoft.AspNetCore.Components.ComponentBase.CallOnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.HandleException(Exception exception)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.HandleExceptionViaErrorBoundary(Exception error, ComponentState errorSourceOrNull)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.AddToPendingTasks(Task task, ComponentState owningComponentState)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView directAndCascadingParameters)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SetDirectParameters(ParameterView parameters)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderRootComponentAsync(Int32 componentId, ParameterView initialParameters)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.CreateInitialRenderAsync(Type componentType, ParameterView initialParameters)
at Microsoft.AspNetCore.Components.Rendering.HtmlRenderer.RenderComponentAsync(Type componentType, ParameterView initialParameters)
at Microsoft.AspNetCore.Components.Rendering.RendererSynchronizationContext.<>c__11`1.<<InvokeAsync>b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.ViewFeatures.StaticComponentRenderer.PrerenderComponentAsync(ParameterView parameters, HttpContext httpContext, Type componentType)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.PrerenderedServerComponentAsync(HttpContext context, ServerComponentInvocationSequence invocationId, Type type, ParameterView parametersCollection)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ComponentRenderer.RenderComponentAsync(ViewContext viewContext, Type componentType, RenderMode renderMode, Object parameters)
at Microsoft.AspNetCore.Mvc.TagHelpers.ComponentTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner.<RunAsync>g__Awaited|0_0(Task task, TagHelperExecutionContext executionContext, Int32 i, Int32 count)
at MyBlazorServerApp.Pages.Pages__Host.<ExecuteAsync>b__14_1() in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\_Host.cshtml:line 21
at Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperExecutionContext.SetOutputContentAsync()
at MyBlazorServerApp.Pages.Pages__Host.ExecuteAsync() in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\_Host.cshtml:line 5
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageCoreAsync(IRazorPage page, ViewContext context)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderPageAsync(IRazorPage page, ViewContext context, Boolean invokeViewStarts)
at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|30_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Exception thrown: 'System.NullReferenceException' in Microsoft.AspNetCore.Components.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.AspNetCore.Components.dll
added 30842
removed 3009
added 43155
```
data refreshed every 10 seconds with about 200_000 lines, NullReferenceException and the pivot table is not updating.
```log
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Content root path: C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application
index page 32282393
Exception thrown: 'System.ArgumentException' in System.Private.CoreLib.dll
index page 37933309
Exception thrown: 'System.IndexOutOfRangeException' in Syncfusion.Licensing.dll
added 35202
Exception thrown: 'System.NullReferenceException' in Syncfusion.Blazor.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
removed 13803
Exception thrown: 'System.NullReferenceException' in Syncfusion.Blazor.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
added 49740
Exception thrown: 'System.NullReferenceException' in Syncfusion.Blazor.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
Exception thrown: 'System.NullReferenceException' in System.Private.CoreLib.dll
```
Please suggest.
Thanks
Yi
|
Query |
Comments | |||
|
In blazor server architecture, your component loads all data to browser and it's up to javascript to build pivot table, or you build the pivoted result on server side, then send back to browser? |
In Blazor server, all operations are performed on the server side, and only the elements to be rendered to the browser are returned via the SignalR connection. Please see the following document for more information on the blazor server mode.
Document: https://docs.microsoft.com/en-us/aspnet/core/blazor/hosting-models?view=aspnetcore-6.0#blazor-server
| |||
|
purely for the mentioned feature, in terms of performance, do you recommend blazor server architecture or the one of web assembly? Please note that I have large dataset - 500k lines |
The Blazor server mode application performs better than the WASM. To render the application with a larger data source, please use the Blazor server application with virtualization. Please see the following UG document for more information on the virtualization option.
| |||
|
It goes wrong with 200_000 lines, data refreshed every 5 seconds with initial wait of 5 seconds.
The application crashed at the very beginning: |
The pivot table processes and summarizes raw data before displaying it in tabular format. In general, the more data takes longer time to process the aggregation of the pivot table values. When we have a large number of unique row and column headers, we can improve performance by using the "Virtualization" option. If we have fewer unique headers with larger amount of data, it will take time to process, since virtualization works by slicing the large number of unique row and column headers alone. As a result, to avoid this problem, you should increase the interval time. Please take the following steps to improve the performance of the pivot table.
Code Example:
[Index.razor]
[PollingService.cs]
To avoid the server disconnection problem, please add the following code to the "Startup.cs" file.
Code Example:
Meanwhile, we have modified your sample for your reference. Please find it from below link.
|
Hi Manikandan,
Thanks for your help.
What do you mean by " unique row and column headers " ?
Another problem that I can't understand:
When I open 2 (or N) browser pages, only the last opened page's data get refreshed. Do you have any explaination? Please suggest.
Many thanks,
Yi
|
Query |
Comments |
|
What do you mean by " unique row and column headers ”? |
The unique row and column headers in the pivot table refer to the unique values in the total data source for the fields bound to the row and column axes, respectively. Please see the screenshot below.
Screenshot:
|
|
When I open 2 (or N) browser pages, only the last opened page's data get refreshed. Do you have any explanation? Please suggest. |
Currently we are analyzing this at our end, and we will update further details within two business days (February 16, 2022). |
|
protected override async Task OnInitializedAsync()
{
Debug.WriteLine($"index page {GetHashCode()}");
await base.OnInitializedAsync();
this.Data = PollingService.Instance.Observable;
if (!registered)
{
//PollingService.Instance.UnRegisterAll();
PollingService.Instance.Register(GetHashCode(), UpdateData);
registered = true;
}
//_timer = new Timer(UpdateData, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));
} |
Hi,
Thanks for you reply!
Regarding this comment of mine:
> 2 (or N) browser pages, only the last opened page's data get refreshed. Do you have any explanation? Please suggest.
Please ignore this interrogation, the cause is completed in my code.
Thanks,
Yi
Hi,
With your last proposed source code, when I navigate from "Home" to "Counter" page, or reversely, I have this exception:
```
System.InvalidOperationException
HResult=0x80131509
Message=Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
Source=System.Private.CoreLib
StackTrace:
at System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported()
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Syncfusion.Blazor.Internal.SfBaseUtils.UpdateDictionary(String key, Object data, Dictionary`2 dictionary)
at Syncfusion.Blazor.SfBaseComponent.ObservablePropertyChanged(Object sender, PropertyChangedEventArgs e)
at MyBlazorServerApp.Pages.ProductDetails.NotifyPropertyChanged(String propertyName) in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\ProductDetails.cs:line 127
at MyBlazorServerApp.Pages.ProductDetails.set_Year(String value) in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\ProductDetails.cs:line 41
at MyBlazorServerApp.Pages.ProductDetails.WithValue(ProductDetails pd) in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\ProductDetails.cs:line 113
at MyBlazorServerApp.Pages.PollingService.Refresh(Object state) in C:\yi\blazor\Create-a-Pivot-Table-in-a-Blazor-Server-Application\Pages\PollingService.cs:line 59
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool)
at System.Threading.TimerQueue.FireNextTimers()
This exception was originally thrown at this call stack:
System.ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported()
System.Collections.Generic.Dictionary<TKey, TValue>.TryInsert(TKey, TValue, System.Collections.Generic.InsertionBehavior)
Syncfusion.Blazor.Internal.SfBaseUtils.UpdateDictionary(string, object, System.Collections.Generic.Dictionary<string, object>)
Syncfusion.Blazor.SfBaseComponent.ObservablePropertyChanged(object, System.ComponentModel.PropertyChangedEventArgs)
MyBlazorServerApp.Pages.ProductDetails.NotifyPropertyChanged(string) in ProductDetails.cs
MyBlazorServerApp.Pages.ProductDetails.Year.set(string) in ProductDetails.cs
MyBlazorServerApp.Pages.ProductDetails.WithValue(MyBlazorServerApp.Pages.ProductDetails) in ProductDetails.cs
MyBlazorServerApp.Pages.PollingService.Refresh(object) in PollingService.cs
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, object)
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
...
[Call Stack Truncated]
```
So, it seems that syncfusion uses a plain Dictionary (does not support concurrency) when ObservablePropertyChanged:
```
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at Syncfusion.Blazor.Internal.SfBaseUtils.UpdateDictionary(String key, Object data, Dictionary`2 dictionary)
```
What is the thread safe way to update the Pivot table when the underlying data source is constantly changing?
Many thanks,
Yi
Hi Manikandan,
I appreciate your reply. This really helps! :)
Hi,
Does it exist a way to be notified when I open the field list dialog and when a close (apply/cancel) it ?
The reason why I want to be notified is that my pivot table data is periodically refreshed (say every 2 seconds). When I open the field list dialog, it keeps blinking, which makes it impossible to do filed drag and drop.
My plan is to stop refreshing the data source of pivot view when I open the field list dialog and restart refreshing one I close it.
Is this the correct way to achieve the purpose?
|
private async void DataBound(Object args)
{
if (IsInit)
{
IsInit = false;
// To call javascript method.
await jsRuntime.InvokeVoidAsync("dataBound");
}
}
[JSInvokable]
public static void FieldListOpen()
{
// This will be triggered when field list popup open.
}
[JSInvokable]
public static void FieldListClose()
{
// This will be triggered when field list popup closed.
} |
|
function dataBound() {
document.querySelector(".e-toggle-field-list").addEventListener("click", fieldListClick);
document.querySelector(".e-defer-cancel-button").addEventListener("click", fieldListCloseClick);
}
function fieldListClick() {
DotNet.invokeMethodAsync('PivotDemo', 'FieldListOpen');
}
function fieldListCloseClick() {
DotNet.invokeMethodAsync('PivotDemo', 'FieldListClose');
} |
|
<script src="scripts/PivotScript.js"></script> |