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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using custom data manager with Spreadsheet

Thread ID:

Created:

Updated:

Platform:

Replies:

132925 Sep 28,2017 12:31 PM UTC Sep 29,2017 12:33 PM UTC ASP.NET Core 1
loading
Tags: Spreadsheet
Liisi
Asked On September 28, 2017 12:31 PM UTC

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?


Shanmugaraja K [Syncfusion]
Replied On 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 


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

;