Hello, please help if possible
how to so that after fifth child parent relationship six child can't be added
Hello,
thank you for reply
I would like not to be able to insert 6 th child in the tree view datasource or in the list below
public class MailItem
{
public string Id { get; set; }
public string ParentId { get; set; }
public string FolderName { get; set; }
public bool Expanded { get; set; }
public bool HasSubFolders { get; set; }
}
List<MailItem> MyFolder = new List<MailItem>();
protected override void OnInitialized()
{
base.OnInitialized();
MyFolder.Add(new MailItem
{
Id = "1",
FolderName = "Inbox",
HasSubFolders = true,
Expanded = true
});
MyFolder.Add(new MailItem
{
Id = "3",
ParentId = "1",
FolderName = "Categories",
Expanded = true,
HasSubFolders = true
});
MyFolder.Add(new MailItem
{
Id = "7",
ParentId = "3",
FolderName = "Primary"
});
MyFolder.Add(new MailItem
{
Id = "14",
ParentId = "7",
FolderName = "Social"
});
MyFolder.Add(new MailItem
{
Id = "25",
ParentId = "14",
FolderName = "Promotions"
});
//I want not to be able to add 6th child to list
MyFolder.Add(new MailItem
{
Id = "34",
ParentId = "25",
FolderName = "Promotions"
});
}
|
[index.razor]
public async void Created()
{
await jsRuntime.InvokeAsync<object>("removeChild");
}
[_Host.cshtml]
<script>
function removeChild() {
document.querySelectorAll('.e-level-6').forEach((item) => {
var element = item.closest('.e-level-5');
if (element != null)
{
element.getElementsByClassName('e-icons')[0].remove();
item.closest('.e-ul').remove();
}
});
}
</script> |