Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#6675 closed enhancement (fixed)

Grid autoheight enhancement

Reported by: guest Owned by: Nathan Toone
Priority: high Milestone: 1.2
Component: DojoX Grid Version: 1.1.0
Keywords: grid autoheight fixed Cc: [email protected]
Blocked By: Blocking:

Description (last modified by Adam Peller)

When dealing with a grid where you have the possibility of content below the grid - it would be nice to have an option to use autoheight until some threshold for number of rows is passed, then move to a fixed height solution. Currently I have a generic grid where the number of rows in the grid could be anywhere from 1 to 500. autoheight in that solution is not acceptable when the grid has 100's of rows. Fixed height looks horrible when there are very few rows and a large area of blank space hiding the other content under the grid. I would like to have a way to tell the grid to switch off autoheight mode after x number of rows. I tried hacking a solution using something like this:

var grid_onComplete = '';

function grid_size_check (items, request) {
	console.log('onComplete - len: ' + items.length);

	if (items.length > 10) {
		// more than 10 rows, switch to fixed height
		theGrid.autoHeight = false; = '300px';
		console.log('fixed height');
	else {
		theGrid.autoHeight = true; = '';

	console.log('updating size');

	// call the real onComplete callback.
	grid_onComplete(items, request);

dojo.declare("custom.GridItemFileReadStore",, {
	fetch: function(request) {
		console.log('custom fetching - height: ' +;
		console.log (request.onComplete);
		grid_onComplete = request.onComplete; // save off the store's current onComplete 
		request.onComplete = grid_size_check; // this hoses things up 
		// Call superclasses' fetch
		return this.inherited("fetch", arguments);

This somehow stopped working for me though. Ideally would be nice to say autoHeightRows="20" which would instruct the grid to automatically set height until 20 rows are reached, if more than that show scrollbars.


Change History (7)

comment:1 Changed 14 years ago by guest

oops - forgot to enclose JS in wiki tags - can someone please modify?

comment:2 Changed 14 years ago by Adam Peller

Description: modified (diff)

comment:3 Changed 14 years ago by nathan

Owner: changed from sorvell to nathan

comment:4 Changed 14 years ago by Nathan Toone

Owner: changed from nathan to Nathan Toone

comment:5 Changed 14 years ago by Nathan Toone

Milestone: future

comment:6 Changed 13 years ago by Nathan Toone

Resolution: fixed
Status: newclosed

(In [14847]) Fixes #6675 - add in ability to specify autoheight as either a boolean (for compatibiilty) or an integer. Specifying an integer signifies the maximum number of rows to autoheight up to. Also cleaned up quite a bit of unused row height code that was encountered during the fix, as well as added in a "rolling average" for the scroller. !strict

comment:7 Changed 13 years ago by bill

Milestone: future1.2
Note: See TracTickets for help on using tickets.