We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Context Menu click event not firing for custom context menu

Hi there, I'm having a small issue with a custom context menu on a grid. Try as I might, I cannot seem to get the click event to fire. Eventually, I'm going to want it to do a postback to server-side, but at the moment I can't seem to get the event to fire at all. Any help would be much appreciated. Code is below. I realise that Delete item is a default menu item, but I'm using MySQL databases rather than SQL and can't seem to find any documentation on how to connect grid to MySQL, so I'm doing it server-side.

<ej:Grid ID="gridBookStock" runat='server' OnServerEditRow="gridBookStock_ServerEditRow" Locale="en-GB">
                    <EditSettings AllowEditing="True" AllowAdding="false" AllowDeleting="True" EditMode="Normal"></EditSettings>
                    <ClientSideEvents ContextClick="contextClick" />
                    <ContextMenuSettings EnableContextMenu="true" DisableDefaultItems="true">
                        <CustomContextMenuItem>
                            <ej:CustomContexMenuItems Id="delete" Text="Delete Item" />
                        </CustomContextMenuItem>
                    </ContextMenuSettings>
                    <ClientSideEvents RowDataBound="rowDataBound" />
                    <Columns>

                        <ej:Column Field="ID" IsPrimaryKey="true" HeaderText="ID" TextAlign="Right" Width="100" Visible="false" />
                        <ej:Column Field="partsid" HeaderText="ID" Width="100" Visible="false" />
                        <ej:Column Field="partname" HeaderText="Description" Width="100" />
                        <ej:Column Field="amount" HeaderText="Quantity" Width="100" EditType="Numeric" />
                        <ej:Column Field="instock" HeaderText="In Stock" Width="100" />
                        <ej:Column Field="availablestock" HeaderText="Available" Width="100" />
                    </Columns>

                </ej:Grid>
              
                <script type="text/javascript">
                    function rowDataBound(args) {
                        if (args.data.availablestock < args.data.amount)
                            args.row.css("backgroundColor", "#F3C3C3").css("color", "black");/*custom css applied to the row */
                    }
                </script>
                <script>

                    function contextClick(args) {

                        alert("hi");

                    }
                </script>


Thanks all...

1 Reply

MS Mani Sankar Durai Syncfusion Team January 19, 2018 12:10 PM UTC

Hi Hywel, 

Thanks for contacting Syncfusion support.  

We have checked your query and we are not able to reproduce the reported issue. We have also prepared a sample that can be downloaded from the below link 
In this sample we have trigger the context click event when the clicking the custom context menu item in grid.  
Please refer the screenshot below 
 
  
If you still face the issue please get back to us with the following details.  
1.       Share the screenshot/ video of the issue that you have faced.  
2.       Share the Syncfusion Essential studio version details. 
3.       If possible please reproduce the issue in the above attached sample 
The provided information will help us to analyze the issue and provide you the response as early as possible  

Regards, 
Manisankar Durai. 


Loader.
Up arrow icon