texnomic / jsonviewer Goto Github PK
View Code? Open in Web Editor NEWASP.NET Core JsonViewer Component for Server-Side Blazor Based-on Alenaksu's Json-Viewer https://github.com/alenaksu/json-viewer.
License: MIT License
ASP.NET Core JsonViewer Component for Server-Side Blazor Based-on Alenaksu's Json-Viewer https://github.com/alenaksu/json-viewer.
License: MIT License
I was trying to use this library. I have the .js referenced in my index.html,
Using it like so:
<JsonViewer @ref="JsonViewerInstance"></JsonViewer>
@code
{
protected JsonViewer JsonViewerInstance { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JsonViewerInstance.Render(JsonConvert.SerializeObject(@User.Value));
await base.OnAfterRenderAsync(firstRender);
}
}
I'm getting the following error:
blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: $ is not a function
TypeError: $ is not a function
at Object.JsonViewer (https://localhost:10001/_content/Texnomic.Blazor.JsonViewer/scripts/JsonViewer.js:9:13)
at https://localhost:10001/_framework/blazor.webassembly.js:1:3332
at new Promise (<anonymous>)
at Object.beginInvokeJSFromDotNet (https://localhost:10001/_framework/blazor.webassembly.js:1:3306)
at Object.St [as invokeJSFromDotNet] (https://localhost:10001/_framework/blazor.webassembly.js:1:59849)
at _mono_wasm_invoke_js_blazor (https://localhost:10001/_framework/dotnet.6.0.2.jez5zq7uy0.js:1:194973)
at wasm://wasm/00970812:wasm-function[219]:0x1a129
at wasm://wasm/00970812:wasm-function[167]:0xcaf7
at wasm://wasm/00970812:wasm-function[166]:0xba0a
at wasm://wasm/00970812:wasm-function[2810]:0xabacf
Microsoft.JSInterop.JSException: $ is not a function
TypeError: $ is not a function
at Object.JsonViewer (https://localhost:10001/_content/Texnomic.Blazor.JsonViewer/scripts/JsonViewer.js:9:13)
at https://localhost:10001/_framework/blazor.webassembly.js:1:3332
at new Promise (<anonymous>)
at Object.beginInvokeJSFromDotNet (https://localhost:10001/_framework/blazor.webassembly.js:1:3306)
at Object.St [as invokeJSFromDotNet] (https://localhost:10001/_framework/blazor.webassembly.js:1:59849)
at _mono_wasm_invoke_js_blazor (https://localhost:10001/_framework/dotnet.6.0.2.jez5zq7uy0.js:1:194973)
at wasm://wasm/00970812:wasm-function[219]:0x1a129
at wasm://wasm/00970812:wasm-function[167]:0xcaf7
at wasm://wasm/00970812:wasm-function[166]:0xba0a
at wasm://wasm/00970812:wasm-function[2810]:0xabacf
at Microsoft.JSInterop.JSRuntime.<InvokeAsync>d__16`1[[Microsoft.JSInterop.Infrastructure.IJSVoidResult, Microsoft.JSInterop, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].MoveNext()
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at Texnomic.Blazor.JsonViewer.JsonViewerBase.Render(String Json)
at redacted.Main.DebugPage.OnAfterRenderAsync(Boolean firstRender) in c:\redacted\Main\DebugPage.razor:line 32
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
Not sure if I'm using it right or if I have add anything else
I just have this simple page:
@using Texnomic.Blazor.JsonViewer
<JsonViewer @ref="JsonViewerInstance"></JsonViewer>
@code {
public string jsonString { get; set; } = "{\"RebateType\": [ \"Commission\", \"Downpayment\", \"Tax Rebate\" ]}";
protected JsonViewer JsonViewerInstance { get; set;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await JsonViewerInstance.Render(jsonString);
await base.OnAfterRenderAsync(firstRender);
}
}
I followed all the instructions and added JQuery as well.
but I get this error in loading:
crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: $ is not a function
TypeError: $ is not a function
at Object.JsonViewer (https://localhost:7131/_content/Texnomic.Blazor.JsonViewer/scripts/JsonViewer.js:9:13)
at https://localhost:7131/_framework/blazor.webassembly.js:1:3337
at new Promise (<anonymous>)
at Object.beginInvokeJSFromDotNet (https://localhost:7131/_framework/blazor.webassembly.js:1:3311)
at Object.Gt [as invokeJSFromDotNet] (https://localhost:7131/_framework/blazor.webassembly.js:1:62569)
at Object.Ii (https://localhost:7131/_framework/dotnet..zr9go7vxvc.js:5:71974)
at _mono_wasm_invoke_js_blazor (https://localhost:7131/_framework/dotnet..zr9go7vxvc.js:6077:71)
at do_icall (wasm://wasm/0334fa86:wasm-function[3646]:0xc6f3b)
at do_icall_wrapper (wasm://wasm/0334fa86:wasm-function[3593]:0xc5e37)
at interp_exec_method (wasm://wasm/0334fa86:wasm-function[3522]:0xb6a22)
Microsoft.JSInterop.JSException: $ is not a function
Hi, It seems the code has been updated via PR to 0.2.0, but the nuget package is still at 0.1.0. Any chance of getting them in sync? Thanks.
This component does not work without jQuery
ReferenceError: $ is not defined
And this is resolved by explicitly loading the jQuery CDN.
But even better would be if this component did not depend on jQuery.
Is it possible to add example blazor app to show how to use your component?
I tried to do steps from readme file but this part does not allow me to compile the code:
Create Backing Element Reference In Example.razor.cs File:
using Texnomic.Blazor.JsonViewer;
protected JsonViewer JsonViewerInstance { get; set; }
protected async ValueTask Example(string Json)
{
await JsonViewerInstance.Render(Json);
}
I get error saying Example method can not exist in the class with the same name
Hi, is it possible to use other methods like Expand, Collapse etc from Blazor Server ?
I only see the Render method on my JsonViewer instance
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.