Categorized view - onClick event when opening a category

Hej,

I have a view that is categorized, the view looks like this:

  • column 1: a main category

  • column 2: a sub category

  • column 3 (flat): a product description (normal text)

On both of the categorized columns 1 + 2 I would like to have a JavaScript onClick event that will set an agent to run that will display a subset of corresponding documents in another frame.

For the main category I have this working.

There is only a problem with the sub-category because one sub-category may also appear in other main categories.

What I want is that the agent displays documents that are listed under one main category AND under one sub-category.

I believe I must rebuild the view in order to set two parameters (main category AND subcategory) to the agent.

But unfortunately I do not how to do this???

Maybe I should rebuild the view with XML? Than at least I can lookup one level higher what the main category is?

Please help me with some guidelines how to solve this?

Thanks in advance,

Patrick

Subject: categorized view - onClick event when opening a category

What is your goal here? Are you attempting to list documents from the currently selected category in a new frame? The first two questions I must ask involve the word “why”. I’m against framesets in general for web development simply because doing it easier in this case almost never involves doing it better. They tend to cause more headaches and unexpected behavior than they are worth in time saved. Also, often opening a link in a new window is generally annoying to the end user and is often (outside a controlled intranet) blocked by the browser’s pop-up settings (if they are set strictly enough) and if not, are even more often extremely annoying to end users. Best to avoid it, as witness the current trend to use divs/spans to mimic dialog boxes. If it is opening in an existing frame, then it’s somewhat better, as long as it will be obvious to the user where the document is opening and they aren’t confused by the change in focus to a new location on the screen.

Getting to that, What is your goal? What is the problem and what do you hope to accomplish with the agent running when you expand the category? What will the "subset consist of that requires building it with an agent? I guess I’m asking why use an agent instead of building the view’s selection formula to handle showing the documents you want and then categorizing them?

Subject: RE: categorized view - onClick event when opening a category

Hej Joel,

You were right about the “why?”:

I would like to show a subset of documents from the currently selected categories (main category plus sub category) in a new frame.

The application is currently using frames so there is nothing to change from that, rebuilding that would demand too much effort (time).

Subject: RE: categorized view - onClick event when opening a category

I think you can do this without an agent, but you need a view that’s categorized so that each group of documents you want to display together is in a single-level category. For instance, you might use a column formula such as:

@If(CatSub = “”; CatMain; CatMain : (CatMain + “~” + CatSub))

Now, in your category links, do not run the agent – instead, just open an ?OpenView URL in the other frame that goes to the appropriate category using a RestrictToCategory URL argument. So in the first column it might be something like:

“[ <a href="LookupCat?OpenView?RestrictToCategory=” + @URLEncode(“Domino”; CatMain) + “" target="otherFrame">]” + CatMain + “[ ]”

and in the second column:

“[ <a href="LookupCat?OpenView?RestrictToCategory=” + @URLEncode(“Domino”; CatMain + “~” + CatSub) + “" target="otherFrame">]” + CatSub + “[ ]”