We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

methods/properties can be accessed only after plugin creation

Good day!!!When I try to get grid instance, i've got this error:Uncaught ejGrid: methods/properties can be accessed only after plugin creation Error: ejGrid: methods/properties can be accessed only after plugin creation at t.throwError (http://localhost:3904/Scripts/ej/ej.web.all.min.js:10:28627)----------------------grid declared in view:@(Html.EJ().Grid("BoxesListGrid").......I'm trying this script:var grid = $("#BoxesListGrid").ejGrid("instance");            grid.ejGrid("refreshContent");

6 Replies

SA Saravanan Arunachalam Syncfusion Team July 7, 2017 04:55 AM UTC

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 



JO John replied to Saravanan Arunachalam July 7, 2017 05:28 AM UTC

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



JO John July 7, 2017 05:46 AM UTC

//refresh button

@Html.InputButton(Html.GetLocalized("Update"), "setExpiredFilter(false)", "refresh")

// ejGrid

@(Html.EJ().Grid("BoxesListGrid")

        .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>



SA Saravanan Arunachalam Syncfusion Team July 10, 2017 04:44 AM UTC

Hi John, 
We have analyzed your provided code example, the cause of the issue is that you have created an instance in the document ready before render the Grid control and we understood from your query you need to refresh the Grid control when click the refresh button. 
So, we suggest you to create an instance in Click event of Button control instead of document ready and please refer to the below code example. 
@(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> 
 
Regards, 
Saravanan A. 



JO John July 10, 2017 06:02 AM UTC

Hi, Saravanan A. 

I'm tried your code, it's all the same



MS Mani Sankar Durai Syncfusion Team July 12, 2017 12:47 PM UTC

Hi John, 

Sorry for the inconvenience caused. 

We suggest you to create the instance of grid using Grid ID. Refer the updated code example 
@(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>  
 

Is you still face the issue please get back to us with the following details. 
1.       Share the screenshot/video of the issue. 
2.       Please ensure whether the provided ID to get the instance is correct. 
3.       From the last update we have get the instance after the grid rendered completely and refreshed the content in the click event of button.  
4.       Share the full grid code also with where you have get the instance of grid. 
The provided information will help us to analyze the issue and provide you the response as early as possible. 

Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Loader.
Up arrow icon