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.
Unfortunately, activation email could not send to your email. Please try again.

how to enforce event

Thread ID:

Created:

Updated:

Platform:

Replies:

132314 Aug 25,2017 08:45 AM Aug 29,2017 07:56 AM JavaScript 3
loading
Tags: ejTreeGrid
Bogumil Styczen
Asked On August 25, 2017 08:45 AM

Hi,

when you double click treegrid node beginEdit event occurs, how to enforce this event from code?

Thanks

Suriyaprasanth Ravikumar [Syncfusion]
Replied On August 28, 2017 08:14 AM

Hi Bogumil, 
 
The “beginEdit” client side event will be trigger only when we perform double click on the record, it is not possible to enforce the “beginEdit” event from code. 
Can you please share some more information about the requirement you needed on the “beginEdit” event, it will be helpful for us to serve you better.. 
 
Regards, 
Suriyaprasanth R. 


Bogumil Styczen
Replied On August 28, 2017 08:33 AM

Hi,

I have tree grid and I want to rename specified node not only by doublicking it, but as the result of clicking button "rename" placed on Ribbon or from the context menuy. That is why I need the possibility of triggering "edit" event. It's the same case like with toolbar button "edit" in treegrid. But i don't what to use toolbar feature. 

Thank you. 


Suriyaprasanth Ravikumar [Syncfusion]
Replied On August 29, 2017 07:56 AM

Hi Bogumil, 
In TreeGrid, we have a public method called “cellEdit” to make any cell to editable state by passing its row index and header text as argument. 
For this method we need to select the row before call the “cellEdit” method, we can select the row in TreeGrid by using “selectedRowIndex” property. 
We also have a public method called “saveCell” to save any edited cell. And also, we can edit any cell/row by using context menu support. 
Please refer following code snippet, 
[JS] 
 
<body> 
    <button onclick="rename()">Rename</button> 
     
    <div id="TreeGridContainer" style="width: 100%; height: 450px;"></div> 
             
$("#TreeGridContainer").ejTreeGrid({ 
                dataSource: sampleData, 
                //.. 
                contextMenuSettings: { 
                    showContextMenu: true, 
                    contextMenuItems: ["add", "edit", "delete"] 
                }, 
}) 
 
    <script> 
        function rename() { 
            $("#TreeGridContainer").ejTreeGrid('model.selectedRowIndex', 2);  // Select the row to edit. 
            var treeObj = $("#TreeGridContainer").ejTreeGrid('instance'); 
            treeObj.cellEdit(2, 'taskName'); // Public method to make any cell to editable state - cellEdit(rowIndex,headerText). 
 
            //$('#TreeGridContainertaskName').val('change'); 
            //treeObj.saveCell(); // Public method to save any edited cell. 
          } 
    </script> 
</body> 
 
We have also prepared a sample for your reference, please find the sample location as below, 
 
Thanks, 
Suriyaprasanth R. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;