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

Using custom data manager with Spreadsheet

I am trying to use remote datamanager with Spreadsheet component. I create and attach the manager like this: 

Html.EJ().DataManager("SpreadSheetDataManager")
                        .URL(@Url.Action("GetData"))
                        .Adaptor(AdaptorType.UrlAdaptor)
                        .Render();

Html.EJ().Spreadsheet<object>("SpreadSheet")
                        .Sheets(sheet =>
                        {
                            sheet.SheetName("Form")
                                .FieldAsColumnHeader()
                                .DataManagerID("SpreadSheetDataManager").Add();
                        })
                         ...
                        .Render(); 

This loads data once after page load.

On client side I use spreadsheet's loadComplete event to access datamanager, extend it (add custom parameters like tableName) and set sheet's datasource to extended adapter.

var customAdaptor = new ej.UrlAdaptor().extend({
    processQuery: function (dm, query, hierarchyFilters) {
        var queryObj = ej.UrlAdaptor.prototype.processQuery(dm, query, hierarchyFilters); /* reused process query from url adaptor */
         
        var data = {
            dataManager: ej.parseJSON(queryObj.data),
            tableName: $spreadSheetObj.data("sheetName"),
        };

        return {
            data: JSON.stringify(data),
            url: queryObj.url + "?test=1",
            ejPvtData: queryObj.ejPvtData,
            type: "POST",
            contentType: "application/json; charset=utf-8"
        };
   },
});

$("#SpreadSheet").ejSpreadsheet("model").sheets[0].dataSource.adaptor = new customAdaptor();

However, it seems that first request for data is made before loadComplete event fires, so custom adapter is not yet used at that moment. I tried to use onLoad event instead, but it looks like this event never fires.
Is it possible to delay requesting data, attach custom data manager and then force loading data?

Also, I need to send some additional information along with data, like cell colors and comments. Is it possible to access such information after data is loaded, so that I could apply it to respective cells?


1 Reply

SK Shanmugaraja K Syncfusion Team September 29, 2017 12:33 PM UTC

Hi Liisi, 
 
Thanks for using Syncfusion products, 
 
We have checked your reported issue and we suggest you to use “load” client side event to achieve your requirement. But we have an issue with that client side event when using ej.DataManager. However, we have logged this as a defect [“Load client side event is not triggered when using data manager”]. We will fix and include this in our Essential studio Vol 4, 2017 release. 
 
Regards, 
Shanmugaraja K 


Loader.
Live Chat Icon For mobile
Up arrow icon