|
Index.Html page
<style>
. . . . . .
.e-row[aria-selected="true"] .e-customizedDragcell {
background-color: #e0e0e0; // set the icon background color to hide it
}
</style>
Index.ts page
. . . .
rowDataBound: function(args) { // triggers before the rowdata get binded to treegrid
if (args.data.taskID == 1) { // checking the condition here
args.row.querySelector('td').innerHTML = " ";
args.row.querySelector('td').className = "e-customizedDragcell"; // add classname to hide the dragicon in treegrid row when given condition satisfied
}
},
rowDragStartHelper: function (args) {
if ( . . . .){ // give the condition here
args.cancel = 'true'; // cancel the drag operation of particular row
}
}, |
|
. . . . . .
rowDrop: function(args) {
var treeGridobj = document.getElementsByClassName("e-treegrid")[0].ej2_instances;
var data = treeGridobj[0].getCurrentViewRecords()[args.dropIndex];
if(data.hasChildRecords){ // give your custom condition here
args.cancel = 'true'
alert("dropping disabled here") // alert message when dropping on parent row
}
},
. .. . . . |
|
[index.ts]
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: dragData,
. . .
rowDrag: function (args) {
let rowEle: Element = args.target ? args.target.closest('tr') : null;
let rowIdx: number = rowEle ? (rowEle as HTMLTableRowElement).rowIndex : -1;
let currentData: ITreeData = this.getCurrentViewRecords()[rowIdx];
if (rowIdx !== -1) {
if (currentData.hasChildRecords)
this.rowDragAndDropModule.addErrorElem();
}
},
treeColumnIndex: 1,
columns: [
. . .
],
});
treegrid.appendTo('#TreeGrid');
|
|
[index.ts]
let treegrid: TreeGrid = new TreeGrid(
{
dataSource: dragData,
. . . .
rowDragStart: function (args) {
args.rows[0].classList.add('e-dragclonerow');
},
treeColumnIndex: 1,
columns: [
. ..
],
});
treegrid.appendTo('#TreeGrid');
------------------------------------------------------------------------------------------------------
[index.html]
<style>
.e-dragclonerow {
font-family: fantasy;
}
</style>
|