Skip to content

973592: Disable default tooltip for symbols in palette #4441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Syncfusion.EJ2.Diagrams;
using System.Drawing;

namespace EJ2MVCSampleBrowser.Controllers.Diagram
{
public partial class DiagramController : Controller
{
// GET: Nodes
public ActionResult Nodes()
{
List<DiagramNode> SymbolPaletee = new List<DiagramNode>();
List<DiagramNode> BasicNodes = new List<DiagramNode>();
BasicNodes.Add(new DiagramNode()
{
Id = "rectangle",
Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.Rectangle },
//To display customized tooltip content by enabling Tooltip Constraints
Tooltip = new DiagramDiagramTooltip() { Content = "custom tooltip content" },
Constraints = NodeConstraints.Default | NodeConstraints.Tooltip
});
BasicNodes.Add(new DiagramNode() { Id = "plus", Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.Plus } });
BasicNodes.Add(new DiagramNode() { Id = "triangle", Shape = new DiagramBasicShape() { Type = Syncfusion.EJ2.Diagrams.Shapes.Basic, Shape = BasicShapes.RightTriangle } });
ViewBag.BasicShapes = BasicNodes;

List<SymbolPalettePalette> palettes = new List<SymbolPalettePalette>();
palettes.Add(new SymbolPalettePalette() { Id = "basic", Expanded = true, Symbols = BasicNodes, Title = "Basic Shapes" });
ViewBag.palettes = palettes;
ViewBag.getSymbolInfo = "getSymbolInfo";
return View();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<ejs-symbolpalette id="symbolpalette" getSymbolInfo="@ViewBag.getSymbolInfo" palettes="@ViewBag.palettes">
</ejs-symbolpalette>
49 changes: 49 additions & 0 deletions ej2-asp-core-mvc/diagram/symbol-palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,55 @@ Here, the code provided below demonstrates how to define tooltip content to symb
{% endtabs %}
{% endif %}

### How to enable or disable the default tooltip for shapes in the Symbol Palette

The `showIdAsTooltip` property lets you control whether the default tooltip appears for symbols in the Symbol Palette. Set this property to false to disable the default tooltip, or to true to enable it. If showIdAsTooltip is not explicitly set, the default tooltip will be displayed.
To control tooltip behavior for each symbol, use the `getSymbolInfo` property. This allows you to selectively enable or disable tooltips for specific symbols within the palette, providing flexibility in how tooltips are presented.

The following code example demonstrates how to enable or disable the default tooltip for shapes in the Symbol Palette.

{% if page.publishingplatform == "aspnet-core" %}

{% tabs %}
{% highlight cshtml tabtitle="CSHTML" %}
{% include code-snippet/diagram/symbol-palette/defaulttooltip/tagHelper %}
{% endhighlight %}
{% highlight c# tabtitle="Description.cs" %}
{% include code-snippet/diagram/symbol-palette/defaulttooltip/description.cs %}
{% endhighlight %}
{% endtabs %}

{% elsif page.publishingplatform == "aspnet-mvc" %}

{% tabs %}
{% highlight c# tabtitle="Description.cs" %}
{% include code-snippet/diagram/symbol-palette/defaulttooltip/description.cs %}
{% endhighlight %}
{% endtabs %}
{% endif %}

```javascript

function getSymbolInfo(symbol) {
//custom tooltip will be shown for the rectangle shape
if (symbol.id === 'rectangle') {
return { showIdAsTooltip: true};
}
//default tooltip will be shown for the plus shapes
if(symbol.id === 'plus') {
return { showIdAsTooltip: true };
}
//default tooltip will not be shown for the triangle shape
if (symbol.id === 'triangle') {
return { showIdAsTooltip: false };
}
return { width: 50, height: 50 };
}

```

N> This property is effective only when tooltip constraints are disabled for the symbol palette element.


### How to provide different tooltip for Symbol palette and diagram elements.

Expand Down