how to enforce event
Hi,
when you double click treegrid node beginEdit event occurs, how to enforce this event from code?
Thanks
SIGN IN To post a reply.
3 Replies
SR
Suriyaprasanth Ravikumar
Syncfusion Team
August 28, 2017 12:14 PM UTC
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.
BS
Bogumil Styczen
August 28, 2017 12:33 PM UTC
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.
SR
Suriyaprasanth Ravikumar
Syncfusion Team
August 29, 2017 11:56 AM UTC
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.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
BS Bogumil Styczen
- Aug 25, 2017 12:45 PM UTC
- Aug 29, 2017 11:56 AM UTC