View Full Version : Showing a subset of all columns
One very handy feature (to me at least) is being able to customise the viewable columns as a subset of all the available columns e,g, Thunderbird, Outlook, Explorer and Nautilus all have a similar ability.
Is this possible w/o too much pain?
This, combined with paging and added to the already amazingly comprehensive feature set would be my ultimate grid!
Robert
jack.slocum
09-11-2006, 10:46 PM
Mr Guest,
This was great idea. I don't know why I didn't think of it. The latest experimental version (http://www.jackslocum.com/build/yui-ext.js) (the version used by this site and the examples) contains the logic to show and hide columns.
If you want to try it out:
Hidden on render is another config option in the column model blob, for example:
...
header: "Common Name",
width: 160,
hidden: true,
editor: new yg.TextEditor({allowBlank: false})
To hide or "unhide" a column programatically:
colModel.setHidden(1, true); // hide column 1
// or
grid.getColumnModel().setHidden(1, true);
There's a new event, onHiddenChange, that can be listened to if you want to plug logic for saving the hide/show state of columns.
Note:
The method isHidden(columnIndex) is now part of the standard ColumnModel interface. So if you have implemented your own ColumnModel by extending AbstractColumnModel, and want hiding/showing of columns to work, you will want to implement this method in your ColumnModel. The stub implementation in AbstractColumnModel just returns false.
Wow it doesn't matter what I do I can't get the HTML and code examples to work. The forum software has issues!
devol
09-12-2006, 02:47 PM
This is much better than trying to hide the columns from the datamodel. Great suggestion.
That's fantastic - thanks for not only the blindingly fast response but for adding it to the codebase so quickly - wow!
(I thought this was the feature request part of the forum not the 'blink and it's done' section ':D'
Actually I lied about the ultimate grid, there is one more thing that would make this grid absolutely perfect (for my needs at least) and that is the ability to have more than one column header row which supported the grouping of columns into sections, Think along the lines of a limited version of Excel's merged cells, e.g. (in ascii with an _ as space to get the alignment closer):
|_________Foo_Group_______|_____________Bar_Group_______________|
|_FooColHdr1_|_FooColHdr2_|_BarColHdr1_|_BarColHdr2_|_BarColHdr3_|
| data rows.... |
I.e. 2 header rows with the first spanning one or more of the second and centered as appropriate, responding to a resize of any of the 'grouped' columns.
Surely, this can't be done so easily :)
Robert (aka Mr Guest)
jack.slocum
09-12-2006, 06:25 PM
Hi Robert,
Yes, I like to move quick while ideas are fresh in my head. If I let them sit around there's always another idea around the corner and the first idea will never get done. ;)
Grouped column headers is a tough one that won't be able to be in this release. It is a good feature though, it's just very difficult to implement generically. It could be accomplished though, but you'd have to override the header creation and header update code to render your own custom version of the headers. That wouldn't be fun since the absolute positioned column splitters, the floating child sort indicators and their buddies wouldn't be very happy. :)
That not to say this won't be revisited in a later release. It is a good feature. Thanks for the suggestion.
Jack
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.