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.

Bind columns in the adapter processResponse callback

Thread ID:





120035 Aug 25,2015 01:26 PM Aug 26,2015 10:22 AM JavaScript 1
Tags: ejGrid
Asked On August 25, 2015 01:26 PM

When I am grabbing data with the data adapter, I am also loading column info. I need a way to bind those columns to the grid once the data has been retrieved. I am doing something like this at the moment,

finalOptions.load = function (args) {
    	    var gridApi = $(element).ejGrid('instance');
    	    var adapter = new ej.UrlAdaptor().extend({
    	        processQuery: function (dm, query) {
                    // processing
    	            return {
    	                data: JSON.stringify(req),
    	                url: url,
    	                ejPvtData: p,
    	                type: "POST",
    	                contentType: "application/json; charset=utf-8"
    	        processResponse: function (data, ds, query, xhr, request, changes) {
                    var columns = formatColumns(data.columns);
    	            return {
    	                count: data.totalItemCount,
                        result: data.data
    	    this.model.dataSource.adaptor = new adapter();
However this is throwing an error, in the columns function in the ejGrid source code. On closer inspection it is this line
var $header = this.element.find(".e-gridheader");
this.element[0].replaceChild(this._renderGridHeader()[0], $header[0]);    
Basically there is no $header, it doesn't exist. It doesn't look like it was rendered initially probably because I initialized the grid with no columns and data?

Prasanna Kumar Viswanathan [Syncfusion]
Replied On August 26, 2015 10:22 AM

Hi Umair,

We have reviewed your requirement. Could you  confirm the following details so we can assist you better:

1.       When we render the grid  without datasource and columns in updated script file we will see the below notification. You have mentioned you are using grid without datasource and columns so can you please share your version of script file (ej.web.all.min.js)

2.       Please share your initialization of Grid code snippet or a sample if possible.


Prasanna Kumar N.S.V


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.

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.