Project

General

Profile

Actions

Bug #805

closed

WMenu wrong nested path selection

Added by Anonymous almost 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
04/29/2011
Due date:
% Done:

0%

Estimated time:

Description

In WMenu, when I use nested internal paths, the content is not updated correctly.

I use the following items in the menu

menu->addItem("items", new Wt::WText("content items"))->setPathComponent("items");
menu->addItem("item1", new Wt::WText("content item 1"))->setPathComponent("items/item1");

When 'item1' receives the first click, itemSelected() is emitted twice. First for 'item1' (correct), and then again for 'items'. This has the effect that the content of 'items' is shown. On a second click, itemSelected() is emitted only once, and the content is updated correctly.

This is similar to #693 but doesn't work for me for this case with the latest git (03019b1).

Attached is a small program that illustrates the problem.

Are nested internal paths something that shouldn't be done, or done differently?

Thanks, Michael


Files

Wt_menu_test.cc (1.46 KB) Wt_menu_test.cc WMenu Test Program Anonymous, 04/29/2011 10:51 AM
Actions #1

Updated by Koen Deforche almost 13 years ago

  • Status changed from New to Feedback
  • Assignee set to Koen Deforche

Hey Michael,

Indeed nested internal paths weren't foreseen. Currently, the first item that matches the current path is considered to be selected. Selecting an item changes the internal path and that's why in this case you get two selection events.

This could be solved by taking only the "most specific" match. And I can't think of anything totally against this, except that the use case seems to be confusing ?

Regards,

koen

Actions #2

Updated by Michael Egli almost 13 years ago

Hi Koen,

My idea was to have bookmarkUrl()'s like the following.

products/
products/prod1/
products/prod2/

This would be closer to traditional html URLs, but I can easily rearrange this. It might not make much sense with a Wt application anyway.

However, what I can see is that the content of the sub-item is displayed only on a second click within an ajax session (current Firefox / Chromium). This, I think, is a bit counter-intuitive.

Thanks, Michael

Actions #3

Updated by Koen Deforche almost 13 years ago

Hey,

In this case it sounds like you should "root" your menu at "/products" ?

Koen

Actions #4

Updated by Michael Egli almost 13 years ago

Hi Koen,

I'm not sure. The products example was only for illustratation. I have other items in my menu that don't point to products.

Also, the documentation of Wt::WApplication::setInternalPath suggests that I should be able to do what I initially wanted.

Michael

Actions #5

Updated by Koen Deforche almost 13 years ago

  • Status changed from Feedback to Resolved

Hey Michael,

I've implemented the best matching algorithm now and the test case now behaves as expected.

Regards,

koen

Actions #6

Updated by Koen Deforche almost 13 years ago

  • Target version set to 3.1.10
Actions #7

Updated by Koen Deforche almost 13 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF