Hi Athiwat,
Thanks using Syncfusion products
According to your query you need to empty the grid dataSource externally. We have achieved your requirement using the dataSource method of Grid.
In the below code example we have emptied the dataSource of the grid using dataSource method in an external button click.
|
<input type="button" onclick="changedata()" value="Clear Datasource" />
<ej:Grid ID="FlatGrid" runat="server" AllowSorting="True" AllowPaging="True" IsResponsive="true">
<Columns>
<ej:Column Field="OrderID" HeaderText="Order ID" IsPrimaryKey="True" TextAlign="Right" Width="75" />
<ej:Column Field="CustomerID" HeaderText="Customer ID" Width="80" />
<ej:Column Field="EmployeeID" HeaderText="Employee ID" TextAlign="Right" Width="75" Priority="4" />
<ej:Column Field="Freight" HeaderText="Freight" TextAlign="Right" Width="75" Format="{0:C}" Priority="3" />
</Columns>
</ej:Grid>
<script type="text/javascript">
function changedata() {
var data = [];
var obj = $(".e-grid").ejGrid("instance");
obj.dataSource(data);
}
</script> |
Please refer the below help documentation for more details.
Please refer the below link for the sample.
If above solution does not resolve your query, please get back to us with more details like how you have tried to empty the Grid data.
Regards,
Vignesh Natarajan