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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

methods/properties can be accessed only after plugin creation

Thread ID:

Created:

Updated:

Platform:

Replies:

131357 Jul 6,2017 10:00 AM UTC Jul 12,2017 12:47 PM UTC ASP.NET MVC 6
loading
Tags: Grid
John
Asked On July 6, 2017 10:04 AM UTC

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");

Saravanan Arunachalam [Syncfusion]
Replied On 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 


John
Replied On 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


John
Replied On 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>


Saravanan Arunachalam [Syncfusion]
Replied On 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. 


John
Replied On July 10, 2017 06:02 AM UTC

Hi, Saravanan A. 

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


Mani Sankar Durai [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;