Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abilibty to Hide "All Categories" and Select the First Category #56

Open
Andy9999 opened this issue Dec 12, 2019 · 0 comments
Open

Abilibty to Hide "All Categories" and Select the First Category #56

Andy9999 opened this issue Dec 12, 2019 · 0 comments

Comments

@Andy9999
Copy link

Andy9999 commented Dec 12, 2019

I made the following change in order to be able to hide the "All categories" that is usually initially selected if using the treeview option. It can get enabled by adding ShowCats="false" to the dnn:DnnTreeView node in the ASCX file. I have not tested the change for any other display type than TreeView. Once ShowCats is set to false, it will, in view mode, hide the "All categories" option and instead select the first category. In page edit mode, it will still display it.

Maybe someone wants to add it to the repo. (Am too lazy atm).

In FAQs.ascx.cs Page_Load I added this to the bottom of the IsPostBack if statement:
if (!IsPostBack) { ...Other stuff... if (!IsEditable) { if (treeCategories.Attributes["ShowAllCats"] != null) { if (treeCategories.Attributes["ShowAllCats"].Equals("false", StringComparison.OrdinalIgnoreCase)) { // Unselect "All Categories", select first cat node and hide "All Categories" treeCategories.Nodes[0].Selected = false; treeCategories.Nodes[1].Selected = true; treeCategories.Nodes[0].Visible = false; // Bind it again BindData(); } } } }

Initially I tried to simply comment out adding "All categories" in the BindCategories() method, but that did lead to some problems as the module expects that initially all questions are shown at least once to render the corresponding javascript correctly. If removing "All categories" at that point, only the questions of the first category would work, so I opted for this quick and dirty way.

Maybe someone else, would like the same change. I hope it helps.

Andy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant