Hi support team,
I would like to add "Load more" button at the end of tree instead of use paging number as the image below
Is there any change to do it?
Or let say I will not use the default paging provided feature. How can I add my custom button at the end of tree like this to handle my custom load more feature? Of course, the button should be put inside tree grid, it appare at the end of tree when user scroll down to bottom.
I ask the question because we got the requirement like this, we have to have the button at the end of tree to load more data. If the current control does not fully support for it. I will do it manually, but I need to know how I can put the custom button at the end of tree
Many thanks,
Tho
Hi Ram,
Thanks for your proposal.
But it seems that we are missunderstand here, my expectation is the button should be placed right after the last row of treegird (not always in the bottom of treegrid)
Regards,
Tho
|
<SfTreeGrid DataSource="@TreeData" @ref="Grid" IdMapping="TaskId" ParentIdMapping="ParentId" AllowPaging="true" TreeColumnIndex="1">
<TreeGridEvents DataBound="DataBoundHandler" TValue="BusinessObject"></TreeGridEvents>
<TreeGridPageSettings PageSize="2"></TreeGridPageSettings>>
</SfTreeGrid>
@code{
SfTreeGrid<BusinessObject> Grid { get; set; }
[JSInvokable("BtnClick")]
public async Task BtnClick()
{
//Here you can handle own logic
}
public void DataBoundHandler(object args)
{
var dotNetReference = DotNetObjectReference.Create(this);
Runtime.InvokeVoidAsync("BtnRender", dotNetReference, Grid.ID);
}
[renderbtn.js]
var dotnetref
function BtnRender(ref, Gridid) {
dotnetref = ref;
var element = document.getElementById(Gridid);
setTimeout(function () {
if (element.querySelector(".e-gridcontent .e-content .gridcontentbtn") == null) {
// get the Grid content
var gridcontent = element.querySelector(".e-gridcontent .e-content");
// get the Grid content table
var contenttable = gridcontent.querySelector(".e-gridcontent .e-content table");
// create the button
var button = document.createElement("button");
button.addEventListener("click", Click);
button.innerText = "BUTTON";
// bind the content table width to the button
//button.style.width = contenttable.getBoundingClientRect().width.toString() + "px";
button.style.width = "200px";
button.classList.add("gridcontentbtn");
gridcontent.appendChild(button); // append the button below to the grid content table
}
}, 0)
}
function Click(args) {
dotnetref.invokeMethodAsync('BtnClick'); // call C# method from javascript function
} |
Hi supporter,
With the second proposal of Jagadesh Ram, is there any change to set pagesize is unlimited? (I can work around by set it to a billion records, but it should not be a good way)
I'm implementing that way but without setting the pagesize, it seems that the default pagesize is somehow is set.
Is there any official way to do it?
Regrads,
Tho
|
<SfTreeGrid DataSource="@TreeGridData" @ref="TreeGrid" IdMapping="TaskId" ParentIdMapping="ParentId" TreeColumnIndex="1" AllowPaging="true">
<TreeGridPageSettings PageSize="@PageSize">
<Template>
@{
<div class="e-pagertemplate" style="width:30px">
<SfButton @ref="ToggleBtn" @onclick="onToggleClick" >Load More</SfButton>
</div>
}
</Template>
</TreeGridPageSettings>
..............
</SfTreeGrid>
@code{
public int PageSize { get; set; }
........
private void onToggleClick(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{
this.PageSize += 20;
}
}
|