Hi Hrvoje,
Thanks for using Syncfusion products.
Query 1: “empty grid on page load and refill it later”
We are glad to let you know that we have achieved your requirement and created a sample which can downloadable from below link.
In the above sample we have not bounded any data to Grid control at initial load. On a button click event, using DataManager we have sent post-back to retrieve data from server-side and we have used “addParams” method of ejQuery to send additional parameter. Then in DataManager done event, we have updated data to grid using “dataSource” Grid method. Please refer to the following code example and documentation links.
<ej:Button ID="ButtonNormal" runat="server" Type="Button" ClientSideOnClick="ButtonNormal_Click" Text="Update Grid"></ej:Button>
<ej:Grid ID="EmployeesGrid2" runat="server" AllowPaging="True">
…
</ej:Grid>
<script>
function ButtonNormal_Click(args) {
var gridObj = $('#<%= EmployeesGrid2.ClientID %>').data("ejGrid");
var query = new ej.Query().addParams("param23", 5);
$('#<%= EmployeesGrid2.ClientID %>').ejWaitingPopup("show");
ej.DataManager({ url: "Default.aspx/DataSource", adaptor: new ej.WebMethodAdaptor()}).executeQuery(query).done(function (e) {
gridObj.dataSource(e.result);
$('#<%= EmployeesGrid2.ClientID %>').ejWaitingPopup("hide");
});
}
</script> |
Documentation links:
Query 2: “getting an error that grid cannot be empty on load”
We suspect that you have not defined any Grid columns and loaded empty data which may be the cause of the issue.
It is necessary to provide either datasource or define Grid columns at initial load. When we do not provide both datasource and Grid columns, it is not feasible to render Grid since there is no information on number of columns and its names.
Regards,
Alan Sangeeth S