Opened 11 years ago

Closed 10 years ago

Last modified 8 years ago

#9254 closed enhancement (fixed)

[patch] [cla] TitlePane: should offer a non-collapsable version, for consistent styling

Reported by: Phil DeJarnett Owned by: bill
Priority: low Milestone: 1.4
Component: Dijit Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:

Description

I currently use dijit.TitlePane? to group form elements. It works great, and for long forms it allows the user to hide sections they aren't using.

However, some sections are mandatory, or at least important enough I don't want them to be accidentally closed.

It would be nice to have an option, say collapsable, which defaults to true, that enables to disables the ability to collapse the panel. It would have to also hide the arrowNode when not collapsable.

Currently I've subclassed TitlePane? with an extremely simple piece of code, and I've attached that.

Attachments (4)

FixedTitlePane.js (387 bytes) - added by Phil DeJarnett 11 years ago.
Subclassed TitlePane? that does not collapse
TitlePane.js (7.9 KB) - added by Ian Fouls 10 years ago.
TitlePane-ief-17-06-2009.patch (1.5 KB) - added by Ian Fouls 10 years ago.
TitlePane.js.patch (5.0 KB) - added by Ian Fouls 10 years ago.

Download all attachments as: .zip

Change History (15)

Changed 11 years ago by Phil DeJarnett

Attachment: FixedTitlePane.js added

Subclassed TitlePane? that does not collapse

comment:1 Changed 11 years ago by bill

Milestone: tbdfuture

Hmm, if we implemented this feature I think it should be the ability to programatically set whether or not clicking the title bar opens/closes the pane. (IE, the pane could still be opened/closed programatically).

And also, I wouldn't want to just hide the arrow, but rather apply some CSS class that themes could use to modify the style, perhaps hiding the arrow or using a different symbol. It would also need to stop using the hand icon when hovering over the title bar, and stop changing the color of the title bar when it was hovered over.

Not sure if it's worth adding to dijit though; as you demonstrated it can be done pretty easily in user code.

Anyway, I'll think about it.

Changed 10 years ago by Ian Fouls

Attachment: TitlePane.js added

comment:2 Changed 10 years ago by Ian Fouls

Hi Bill

My enhancement request in 9425 which was closed had most of your queries done. Specifically it can be changed programatically and sorts out the relevant CSS stuff. What I havn't done is anything to do with a different icon, I just hide it, but having said that if it's fixed then what would the icon do anyway? clicking it would achieve nothing in the fixed state.

Please see the attached file, all if not most of the work has been done for you.

I have seen a few requests for this functionality myself when browsing for a solution.

comment:3 Changed 10 years ago by bill

I saw you attached a file to #9425 but have you filed a CLA? We can't accept contributions w/out them. Also, if you've filed a CLA, then can you attach the changes as a patch/diff file?

BTW I think there should be changes to both TitlePane.js and the related CSS files.

Changed 10 years ago by Ian Fouls

comment:4 Changed 10 years ago by Ian Fouls

CLA filed and patch file attached.

I've not made any changes to the CSS, the features are all turned on & off in the script file. The only 2 possible candidates in my changes that could be moved to the CSS are for changing the title cursor and display of the icon. All other stuff is just simply disabled if canToggle is not set.

comment:5 Changed 10 years ago by bill

Milestone: future1.4
Summary: dijit.TitlePane should offer a non-collapsable version, for consistent styling[patch] [cla] TitlePane: should offer a non-collapsable version, for consistent styling

OK thanks, let me take a look.

comment:6 Changed 10 years ago by bill

Actually that's not a valid patch file, can you try to recreate it?

Looks like you are running "diff" to generate the patch. I'm using the patch generation from my IDE (I know there are options on eclipse, tortoiseSVN, and intellij for this) but I think you could also run "patch" on unix based systems. A correct patch file should list file names and revisions in it.

Changed 10 years ago by Ian Fouls

Attachment: TitlePane.js.patch added

comment:7 Changed 10 years ago by Ian Fouls

Hi Bill

New patch file attached.

comment:8 Changed 10 years ago by bill

Owner: set to bill
Status: newassigned

Thanks, that looks much better :-). BTW you should be creating patches against the source (pulled from SVN), not a built version of dojo, but anyway I was able to apply it.

I'm going to update it so that the cursor is set via CSS (probably not important but it's a trivial change), and more importantly so that the icon can be controlled via CSS, in case theme designers want an icon displayed for locked-open or locked-closed TitlePanes.

Oh, and also I don't want to make attr('canToggle', ...) automatically open the pane, so I'm going to remove that code and tell users to do attr('open', ...) to open a pane, if necessary. Automatically opening the pane is probably harmless, but seems unnecessary. Actually, it seems unlikely that people will set toggle-ability except on creation time, so might as well minimize the number of lines of code.

comment:9 Changed 10 years ago by Ian Fouls

I must admit after I posted the file I did think about the SVN version but I needed some time out, so sorry for not sorting that.

The rest sounds good, thanks for accepting this ammendment.

comment:10 Changed 10 years ago by bill

Resolution: fixed
Status: assignedclosed

(In [18285]) Add toggleable attribute to TitlePane?, so developers can create a TitlePane? that users cannot open/close by clicking (either via mouse or keyboard). Fixes #9254 !strict.

comment:11 Changed 8 years ago by bill

In [27076]:

Don't show open/close icon if pane isn't toggleable. It confuses the user. Refs #9254.

Note: See TracTickets for help on using tickets.