Try our conversational search powered by Generative AI!

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



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?

Aug 15, 2014 22:36

I have the same need. Anyone?

Sep 19, 2014 9:38

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;

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) {

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

Hope this helps.

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.