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);
gridApi.columns(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?