question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

During Edit.TagToolbar customization when moving edit button to a different group and adding a custom button everything breaks and whole page becomes unclickable.

See original GitHub issue

I’m submitting a … [x] bug report => search github for a similar issue before submitting

…about [x] edit experience / UI [x] admin experience UI

Current behavior I was trying to make tagtoolbar first menu group contain 2 buttons: default edit button for certain entity object and custom button. However even though they work perfectly when used separately if I use both and click edit button - everything breaks. And I mean console has this error: ERROR Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: '3/9/edit' Error: Cannot match any routes. URL Segment: '3/9/edit' and also whole page becomes unclickable so I have to reload the page to make anything work.

Here is the code I used: @Edit.TagToolbar(entityObj, toolbar: new[] { "-edit", "+group=mainGroup", "+edit&group=mainGroup", "+custom&icon=icon-sxc-cancel&group=mainGroup&color=red?call=customJsFunction&param1=" + entityObj.EntityId + "&param2=" + entityObj.Title })

Expected behavior After applying code sample from above edit button should work.

Instructions to Reproduce the Problem

  1. create some entity type and add at least one entity object there.
  2. edit your cshtml file by adding to any div tag you like this code: @Edit.TagToolbar(entityObj, toolbar: new[] { "-edit", "+group=mainGroup", "+edit&group=mainGroup", "+custom&icon=icon-sxc-cancel&group=mainGroup&color=red?call=customJsFunction&param1=" + entityObj.EntityId + "&param2=" + entityObj.Title })
  3. either add variable entityObj before this code and assign to it your entity object or edit variable name to pass there your entity object
  4. save code changes and open the page in browser
  5. click edit button and see error message in dev tools console and see the page that became not interactable (clicking anything doesn’t work)

Why change the behavior? Because broken edit button for entity is crutial. It’s basic CRUD functionality for module that is must have.

Your environment Windows 10 Visual Studio 2019

  • 2sxc version(s): 11.22.1
  • Browser: Chrome 94.0.4606.81
  • DNN: 9.10.00
  • Language: English

Anything you would like to add

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
iJungleboycommented, Nov 18, 2021

So here’s the cause:

the toolbar parameter can be different things - the old APIs gave it a complex tree-style object to configure the toolbar, and the new v10 API gives it an array of strings.

It appears than under certain circumstances, the Razor compiler will treat the new[] { "-item-history", "+item-history", "-edit", "+group=mainGroup", "+edit&group=mainGroup", "+custom&icon=icon-sxc-cancel&group=mainGroup&color=red?call=customJsFunction&id=" + itemObject.EntityId + "&name=" + itemObject.Name } as an object[] instead of a string[], in which case ATM it assumes it’s the old API, and doesn’t process the parameters.

I’ve updated the code to better detect this. as a workaround you can spend some time ensuring it’s an IEnumerable<string> instead of an IEnumerable<object> and you could already fix this now, but a real fix will be in the next release.

1reaction
iJungleboycommented, Nov 17, 2021

I can reproduce. Still working on the cause, but it appears that…

  1. The Edit.Toolbar(...) doesn’t add the details for the item in the toolbar (server-side)
  2. The dialog then opens, but since it errors, it will not properly initialize, so the click-to-close fails

…working on it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Edit.TagToolbar and @Edit.Toolbar Methods in Razor / .net
How to use. Here's a quick example of using the Edit object in a Razor template: <h1 @Edit.TagToolbar ...
Read more >
In-Page Edit-Item Toolbars and Buttons
The toolbars for the editor can be hovering above the elements - usually ... TagToolbar which works using an sxc-toolbar attribute instead of...
Read more >
cs 285 assignment 10 Flashcards
Click Options to open the Excel Options dialog. Click Customize Ribbon. Click the New Tab button. Click New Tab (Custom) to select it....
Read more >
How To Create A Custom Button On Quick Access Toolbar To ...
In this advanced excel tutorial I'll show you how you can customize quick access toolbar in excel. But our main goal is to...
Read more >
How to customize TinyMCE toolbar options and settings
This article covers a few of the most common customizations, including adding and removing toolbar buttons, moving the toolbar, and hiding ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found