November Happy Hour will be moved to Thursday December 5th.

Dojo/Dijit: Change sorting and what columns to render in ContentQueryGrid

Vote:
 

Hi,

How can I change what to sort on and which columns to render in my component? Default sorting is name descending and name and status columns are rendered.

I've tried to set the queryOptions from my component, but with no luck. My grid's attach point is contentQuery.

var queryOptions = {};
queryOptions.sort = [{ attribute: "anotherColumn", descending: false }];

this.contentQuery.grid.set("queryOptions", queryOptions);

One way that seems to work is to inherit from the grid and create my own, but that seems unnecessary?

#89432
Aug 15, 2014 22:36
Vote:
 

I have the same need. Anyone?

#90854
Sep 19, 2014 9:38
Vote:
 

Sorry Alexander, missed your question here. Yes, ther is a fix for this. I ended up overriding the fetchData method in postCreate. I have not changed which columns to render though.

postCreate: function () {
	this.contentQuery.fetchData = this.fetchData;
	this._reloadQuery();
},

fetchData: function () {
	this.grid.set("queryOptions", {
		ignore: ["query"],
		sort: [{
			attribute: "name",
			descending: false
		}]
	});

	var queryParameters = this.queryParameters || {};
	queryParameters.query = this.queryName;

	this.grid.set("query", queryParameters);
},

_queryTextChanged: function (value) {
	this._reloadQuery();
},

_reloadQuery: function () {
	this.contentQuery.set("queryParameters", { q: this.queryText.value });
	this.contentQuery.set("queryName", this.queryName);
}

Hope this helps.

#91244
Sep 30, 2014 19:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.