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

Grid hangs when using custom adapter even though for testing I set a manual value in proccessResponse

Is processResponse the last step before binding data to the grid.  Currently the grid just hangs with a spinning circle.

I am setting the results manually in processResponse to 
let results =  { result: [], count: 0 }
but it still hangs.  Normally I pass in a array on object for the value of result.  But the empty array should just result in empty results not a hang with spinning circle

Attached is my adapter if you could possibly take a look at it.

Thank you.

The attachment is the adapter.

Attachment: syncfusionfeathersadapter_4196a6b2.7z

The below is the grid being bound

let customers = await  this.api.customers.find();
let dataManager = new ej.DataManager(customers);
dataManager.adaptor = new this.adapter.feathersAdapter();


$("#Grid").ejGrid({
dataSource: dataManager,
toolbarSettings: {
showToolbar: true,
toolbarItems: ["add", "edit", "delete"]
},
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
editMode: "dialog"
},
allowPaging: true,
allowSorting: true,
allowFiltering: true,
filterSettings: {showPredicate: true, filterType: "menu", enableCaseSensitivity: true},
searchSettings: {ignoreCase: false},
isResponsive: true,
columns: [
{"field": "first_name"},
{"field": "last_name"},
{"field": "company"},
{"field": "id", "isPrimaryKey": true}
]
});
}

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team September 6, 2017 01:48 PM UTC

Hi Dan, 

Thanks for contacting Syncfusion support. 

We created a sample with your adaptor and we can reproduce the mentioned issue in our sample. In this you have mentioned the grid just hangs with a spinning circle. The spinning circle will displayed when we face any script error in console page. In our sample we faced script error in console page.  
 
In adaptor code example you have an method called convertToQueryString. In this method we get the object as undefined for the mentioned code(var obj = req.sort[0]). If the object has undefined then we will face script error while using Object.entries method. To avoid the script error, we suggest you to check the mentioned condition before the for loop. 
 
Find the code example and sample:  
 
 
convertToQueryString: function (req, query, dm) { 
                ------- 
                    var obj = req.sort[0] 
                    if (!ej.isNullOrUndefined(obj)) { 
                        for (var key in Object.entries(obj)) { 
                            str += '$sort[' + key + ']=' + value + '&' 
                        } 
                    } 
               } 
              return str 
            }, 
  

Regards, 
Prasanna Kumar N.S.V 


Loader.
Live Chat Icon For mobile
Up arrow icon