Opened 9 years ago

Closed 4 years ago

#12572 closed defect (patchwelcome)

store.JsonRest with enhancedgrid cause undefined in url

Reported by: fabioginzel Owned by: Kris Zyp
Priority: high Milestone: tbd
Component: DojoX Grid Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

	memoryStore = new dojo.store.Memory({});
	restStore = new dojo.store.JsonRest({target:"url/"});
	cacheStore = new dojo.store.Cache(restStore, memoryStore)
	dataStore = new dojo.data.ObjectStore({objectStore: cacheStore});	
	gridCredencia.setStore(dataStore);

if click in sorting cause url: url/undefined?sort(+name)

sorry about my english

Change History (3)

comment:1 Changed 9 years ago by Jared Jurkiewicz

Owner: changed from Jared Jurkiewicz to Kris Zyp

comment:2 Changed 8 years ago by frans.van.nieuwenhoven

I ran into this problem as well and solved it with a small fix in dojo.store.JsonRest.js.

The cause of the problem is the query argument being undefined in the query function (line 115). Fixed by adding a line to the 'options.sort if':

if(options && options.sort){
	if (!query) query = "";   // prevent appending to undefined and null
	query += (query ? "&" : "?") + "sort(";
	for(var i = 0; i<options.sort.length; i++){
		var sort = options.sort[i];
		query += (i > 0 ? "," : "") + (sort.descending ? '-' : '+') + encodeURIComponent(sort.attribute);
	}
	query += ")";
}

comment:3 Changed 4 years ago by bill

Component: DataDojoX Grid
Resolution: patchwelcome
Status: newclosed

DojoX Grid and EnhancedGrid are deprecated in favor of dgrid and gridx.

You should upgrade your code to use one of those two grids.

It's possible the community may consider patches to the old DojoX Grid code though.

Note: See TracTickets for help on using tickets.