Hi John,Thanks for contacting Syncfusion’s support.We have analyzed your query and we suspect that you have tried to create an instance for the Grid control before render it which was the cause of the issue.So, please ensure whether you have got the instance of Grid control after the control is rendered.If the issue is still exist, please provide the below details.1. Where did you get the instance like any specific event/document ready?2. Please share your view code.Regards,Saravanan A
On the page I have some filters(like date period etc.). use case of the page: user fill filters, then press button Refresh, after then my js script calls
PS: Grid is already rendered with default filter parameters, i need to refresh data
//refresh button
@Html.InputButton(Html.GetLocalized("Update"), "setExpiredFilter(false)", "refresh")
// ejGrid
@(Html.EJ().Grid
.Datasource(ds => ds.URL(Url.Action("_SBoxDocs", "Documents", Model))
.EnableCaching()
.CachingPageSize(10)
.TimeTillExpiration(120000)
.Adaptor(AdaptorType.UrlAdaptor))
.AllowResizing()
.AllowSorting()
.SortSettings(sort => sort.SortedColumns(col => col.Field("RegDate").Direction(SortOrder.Descending).Add()))
.AllowPaging()
.AllowTextWrap()
.AllowSelection()
.SelectionType(SelectionType.Single)
.Columns(col =>
{
col.Field(f => f.RegNum).HeaderText("RegNum").TextAlign(TextAlign.Left).Width(75).Add();
col.Field(f => f.RegDate).HeaderText("RegDate").Width(80).Add();
col.Field(f => f.MessageName).HeaderText("MessageName").TextAlign(TextAlign.Left).Priority(4).Width(75).Add();
col.Field(f => f.OutDate).HeaderText("OutDate").TextAlign(TextAlign.Left).Width(80).Add();
})
.ClientSideEvents(ev => ev.RowDataBound("onSRowDataBound").RowSelected("onSRowSelect").Load("SfilterBindingData"))
)
@Html.EJ().ScriptManager()
<script>
var grid = $("#BoxesListGrid").ejGrid("instance");
grid.ejGrid("refreshContent");
</script>
@(Html.EJ().Button("Refresh").Text("Refresh").ClientSideEvents(cl=>cl.Click("OnClick")))
@(Html.EJ().Grid<object>("BoxesListGrid")
. . .
)
<script>
function OnClick(e) {
var g = $("#ForeignKey").ejGrid("instance");
g.refreshContent();
}
</script> |
Hi, Saravanan A.
I'm tried your code, it's all the same
@(Html.EJ().Button("Refresh").Text("Refresh").ClientSideEvents(cl=>cl.Click("OnClick"))) @(Html.EJ().Grid<object>("BoxesListGrid")
. . .
)
<script>
function OnClick(e) {
var g = $("# BoxesListGrid").ejGrid("instance"); // BoxesListGrid is the grid ID
g.refreshContent();
}
</script>
|