If I loop through the list and set one value for each loop, how do I bind the values for this loop?

If I loop through the list and set one value for each loop, how do I bind the values for this loop?


For example, I use el table




3 Replies

KV Keerthikaran Venkatachalam Syncfusion Team October 18, 2023 02:25 PM UTC

Hi xu zhi bin,


We can’t understand your requirements exactly. You need to set the context menu item using looping. Can you provide more information about this query? Based on that, we will check and provide you with a better solution quickly.


Regards,

KeerthiKaran K V



XZ xu zhi bin replied to Keerthikaran Venkatachalam October 19, 2023 12:50 AM UTC

Dynamically generated, how do I know which user my context belongs to? User's Id needs to be bound in the context menu





KV Keerthikaran Venkatachalam Syncfusion Team October 27, 2023 03:02 PM UTC

Hi Xu zhi bin,


We have checked your reported query, and you set the id in the items property of the context menu and got the id from the select event of the context menu while selecting menu items. Please refer to the below code snippet and sample.


menuItems: [

        {

          text: "Cut",

          id: "menu1",

          iconCss: "e-cm-icons e-cm-cut"

        },

        {

          text: "Copy",

          id: "menu1",

          iconCss: "e-cm-icons e-cm-copy"

        },

        {

          text: "Paste",

          id: "menu1",

          iconCss: "e-cm-icons e-cm-paste",

        }

      ],

…..

<ejs-contextmenu cssClass='e-cmenu-wrapper' id="contextmenu1" ref="contextMenu" target="#contextmenutarget" :items="menuItems" :beforeItemRender="beforeItemRender" :select="select"></ejs-contextmenu>

……..

select: function(args) {

     var selectedMenuId = args.item.id;

 }


Sample link: https://stackblitz.com/edit/vkj1gq-8wnhrg?file=src%2FApp.vue


Please let us know if you need any further assistance on this.


Regards,

KeerthiKaran K V


Loader.
Up arrow icon