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

childGrid makes another call to the controller.

Hi, 
I have a problem with a child grid, that is added to the main one on the loadGrid event:

the main grid:

<ejs-grid id="my-grid" dataBound="dataBound" load="loadChild" [...]
      <e-data-manager url="@Url.Action("UrlDataSource")" adaptor="UrlAdaptor"></e-data-manager>
     [...]

and the child has it's own urlAdaptor.

    function loadChild() {
        this.childGrid = {
            dataSource: new ej.data.DataManager({
                url: "@Url.Action("UrlChildDataSource")",
                adaptor: new ej.data.UrlAdaptor(),
                crossDomain: true
            }),
            queryString: 'rowguid',
            allowPaging: true,
            allowSorting: true,
            dataBound: function () {
                this.autoFitColumns();
            },
            pageSettings: {pageSize: 5},
            columns: [
                { field: 'displayName', headerText: 'Display Name', width: 200 },
                [.......]
            ],
        };
    }

I'm getting 2 calls when the page/grid loads to the main grid controller... if I comment that event (and omit the child grid) I get only one call.
As you see, the adaptors are diferent endpoints.
Any Idea of what I am doing wrong?

thanks.

3 Replies

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team August 2, 2019 09:29 AM UTC

Hi Pablo,  

Thanks for contacting Syncfusion Support.  

We can reproduce the reported problem at our end. All properties in the Grid will trigger an onPropertyChange method. Based on the properties, Grid will be refreshed. In your cases, since the childGrid has been assigned, the entire content has been re-rendered followed by refreshing them. To avoid this problem, we suggest to use the setProperties method with the second (mute on change) parameter as true. Refer to the following code example.  

<div class="control-section"> 
    <ejs-grid id="HierarchyPrint" load="onLoad"> 
        <e-data-manager url="@Url.Action("UrlChildDataSource")" adaptor="UrlAdaptor"></e-data-manager> 
           . . . 
             . . . 
    </ejs-grid> 
</div> 
 
<script> 
    function onLoad(args) { 
        this.setProperties({ 
            childGrid: { 
                dataSource: new ej.data.DataManager({ 
                    url: "@Url.Action("UrlDataSource")", 
                    adaptor: new ej.data.UrlAdaptor() 
                }), 
                queryString: 'EmployeeID', 
          . . .  
                 . . . 
            } 
        }, true); 
    } 
</script> 

Regards,  
Seeni Sakthi Kumar S. 



PK pk August 2, 2019 01:14 PM UTC

Thank you very much. Solved.


SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team August 2, 2019 01:20 PM UTC

Hi Pablo,  

Greetings from Syncfusion. 

We are happy to hear that your requirement has been achieved and you are good to go. 

Please get back to us, if you require further assistance on this.  

Regards,  
Seeni Sakthi Kumar S. 


Loader.
Live Chat Icon For mobile
Up arrow icon