Ticket #6675 (new enhancement)
Grid autoheight enhancement
| Reported by: | guest | Owned by: | toonetown |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | DojoX Grid | Version: | 1.1.0 |
| Severity: | normal | Keywords: | grid autoheight fixed |
| Cc: | josh@… |
Description (last modified by peller) (diff)
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;
theGrid.domNode.style.height = '300px';
console.log('fixed height');
}
else {
theGrid.autoHeight = true;
theGrid.domNode.style.height = '';
console.log('autoHeight');
}
console.log('updating size');
theGrid.update();
theGrid.resize();
// call the real onComplete callback.
grid_onComplete(items, request);
}
dojo.provide("custom.GridItemFileReadStore");
dojo.declare("custom.GridItemFileReadStore", dojo.data.ItemFileReadStore, {
fetch: function(request) {
console.log('custom fetching - height: ' + theGrid.domNode.style.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.
Thanks!