The functionality of SyncFusion TreeGrid ContextMenu appears to be incompatible with vue3

Having trouble implementing a context menu in my SyncFusion TreeGrid. Despite following the instructions, nothing seems to be working for me. Here's a snippet of my code:

<template>
<ej2-treegrid
    :dataSource="tabla"
    :contextMenuItems="contextMenuItems"
    rowHeight="20px"
    ><e-columns>
        <e-column field="nombre" headerText="Nombre"></e-column>
        <e-column field="cantidad" headerText="Cantidad"></e-column>
        <e-column field="vu" headerText="Valor Unitario" format="C"></e-column>
        <e-column field="precio" headerText="Precio" format="C"></e-column>
    </e-columns>
</ej2-treegrid>
</template>

<script setup>
import { ref, reactive, provide } from "vue";
import { TreeGridComponent as ej2Treegrid,
    ColumnsDirective as eColumns,
    ColumnDirective as eColumn,
    ContextMenu,
} from '@syncfusion/ej2-vue-treegrid';

provide("treegrid", [ContextMenu]);

const contextMenuItems = ["Cancel"];

const tabla = reactive([{id: 1, nombre: "", cantidad: 2, vu: 2, precio: 2}]);
</script>

It's puzzling where I might have gone wrong. Could it be related to the 'provide' section? The documentation appears tailored for vue2.

Upon right-clicking on the grid, only the default context menu pops up. I've encountered similar issues with editing functionalities.

Answer №1

It appears that there may be an issue with the injection of the context menu module. Upon reviewing your provided code snippet, we noticed that the `provide` part is causing an error. We recommend adjusting your code as follows:

Your code:

provide("treegrid", [ContextMenu]);

Updated code:

provide: {
  treegrid: [Page, ContextMenu, Edit,],
}

We have also created a simple Vue3 sample that includes a context menu and editing feature for your reference:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Interactive Vue components with dynamic children and sub-children

In my Vue application, I have a component called Address.vue which contains a child component called Contact.vue. One address can contain multiple components What I have accomplished: I have implemented the functionality in the Address.vue component t ...

what is the most effective method for integrating Vue with Express?

1: I have successfully installed expressjs on my system. 2: Following that, I used npm to install the vue framework by running 'npm install vue --save'. 3: Additionally, I utilized handlebars as the template-engine for expressjs. In my index.hbs ...

Adjusting the size of a Vue component on the fly

I'm struggling to find a way to dynamically adjust the width of a component. The component I am working with is called 'vue-burger-menu' -> https://github.com/mbj36/vue-burger-menu. To set the width, you need to assign a number to the prop ...

Exploring the power of data-callbacks in VueJS

For instance, if we have <div data-callback="recaptchaCallback"></div>, the recaptchaCallback function will run as shown: <script> function recaptchaCallback() { alert('OK'); } </script> The code above functions prop ...

Learn how to retrieve an array within an object by clicking on a specific button

Currently, I am in the process of creating a filter and its corresponding labels. The objective is to allow users to select from various options when they click on the first row. While I have successfully implemented the functionality to display choices fo ...

Implementing dynamic component swapping in Vue 3 using components from another component

I currently have a display component called app-display, which contains a dynamic component inside (by default, it is set to app-empty): app.component('appDisplay', { template: `<component :is="currentComponent"></c ...

How can I implement an autocomplete feature in Vue.js?

Recently, I started working with Vue and decided to create a basic search app using Vue.js cdn. My goal is to add a suggestion bar that displays user IDs from a fake JSON server. For instance, if I input '1' in the search bar, I want only the use ...

Cypress and VueJS: How to target elements that are dynamically generated following a specific user interaction

I am currently testing a new feature where a button will only appear for the user to click after they have completed another action. Before proceeding with the action, I am verifying if the button exists: cy.get('span') .contains('Selec ...

Transfer content within <pre> tags to the clipboard using a Vue.js application

I am currently developing a Chrome extension using Vue.js where I aim to copy the content within a pre tag section to the clipboard with the click of a button. By assigning an element ID to the pre tag, I can retrieve the content using a copyToClipboard() ...

Quasar version 2 (Vue) introduces an exciting new feature in the QTable component - the ability to

Could someone provide some guidance on how to create a table with nested elements like the one shown in the screenshot? View table image here I am facing an issue connecting additional drop-down lines within the table. Is there functionality available fo ...

Guidelines for integrating Bootstrap-Vue into an ASP.net project within VisualStudio 2017

While we have a NuGet package available for Vue 2.5 to easily set things up in an ASP.net project in Visual Studio 2017, unfortunately, there is currently no Bootstrap-vue NuGet package. The Bootstrap-vue website provides instructions only for NPM and YAR ...

Leveraging the html-webpack-plugin for creating an index.html file within Webpack (specifically in a project based on the vue-simple boiler

For every build in Webpack, I am attempting to create a customized index.html file. In order to achieve this, I have incorporated html-webpack-plugin. I comprehend that to generate an index.html file within my dist directory, the following configurations ...

There seems to be a problem with the text-to-speech API: It looks like there's a ReferenceError stating that

Currently, I am developing a program using the Quasar framework which is based on Vue and can be compiled for mobile using Cordova. However, I am encountering some issues when trying to run it on mobile. Below is the function causing problems: activat ...

Discovering the process of using Vitest in Vue 3 to test examples involving haveBeenCalledWith

Despite my struggles, including purchasing a course on testing Vitest in Vue 3 on Udemy, nothing seemed to work. However, I finally found a solution that might be helpful for others facing the same issue. ...

Sharing state among multiple instances of the same Vue3 Component using the Composition API

I've been diving into the world of Vue 3 and exploring the Composition API, but I'm struggling to get multiple instances of the same component to work properly. <Loader /> <Loader /> <Loader /> In my Loader.vue file: export def ...

Tracing a path with a snapping motion using my thumb

Before we begin, let's take a look at the example below. The functionality of this component should mimic that of an input type range. However, I am facing some challenges in calculating the step value and snapping the thumb onto the trail based on t ...

Creating a table in VueJs and populating it with values retrieved from an MSSQL database in a .NET Core web application

I am developing a table within a .NET Core Web Application that includes multiple rows and columns filled with data retrieved from a MSSQL server through a WEB API Given the need for numerous rows and columns, I am considering using a for loop inside my & ...

CSS mismatch detected between production and development modes

Currently, I am utilizing the Vuetify framework coupled with custom CSS for a project developed using a webpack template. During development mode, my custom CSS modifications are successfully applied to HTML elements; however, in Production mode, these cha ...

Display a pre-set placeholder option in a select dropdown using VueJS

I am having trouble setting a pre-selected and disabled placeholder in a select element using VueJS. I want "Choose your saved prescription" to be the default option when the page loads, but currently it shows a blank select with the placeholder as an op ...

Why is Axios not being successfully registered as a global variable in this particular Vue application?

Recently, I have been delving into building a Single Page Application using Vue 3, TypeScript, and tapping into The Movie Database (TMDB) API. One of the hurdles I faced was managing Axios instances across multiple components. Initially, I imported Axios ...