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

Timeline - Group with widget bug? #105

Closed
aznwarmonkey opened this issue Apr 16, 2013 · 3 comments
Closed

Timeline - Group with widget bug? #105

aznwarmonkey opened this issue Apr 16, 2013 · 3 comments
Labels

Comments

@aznwarmonkey
Copy link

Hi,

I am having problems adding widgets into the grouping section of the Timeline widget
When i add a button to the timeline, It shows up but the click event does not register. Is there a work around for this? Below is the code I used and attached is how it displays.

final FlexTable table = new FlexTable();
        table.setWidth("100%");

        final HTML labelPanel = new HTML("Group: " + group);
        labelPanel.getElement().getStyle().setFontWeight(FontWeight.BOLD);
        table.setWidget(0, 0, labelPanel);

        final Button button = new Button("Button");
        button.addClickHandler(new ClickHandler() {

            public void onClick(final ClickEvent p_event) {
                Window.alert("Button");
            }
        });

        table.setWidget(0, 1, button);

final HTMLPanel htmlPanel = new HTMLPanel("");
        htmlPanel.add(table);

item.put("group", new JSONString(htmlPanel.toString()));
timelineEx

@josdejong
Copy link
Contributor

Stringfying your HTML strips all eventhandlers that you created. The current grouping functionality is very limited, and not suited for this type of use as it only accepts a string.

What you can try as a workaround is something like this:

  • Create a string with your group html where the button has an id, like

    item.put('group', 'Group: 0<button id="button0">Button</button>');
    
  • After the Timeline is rendered, attach the event handler to the button. Using jquery that will look like:

    $('#button0').click(function () { 
        alert('You clicked button0'); 
    });
    

@ova2
Copy link
Contributor

ova2 commented Apr 16, 2013

Good suggestion. But I think we should really improve the grouping feature. Providing long strings (with complex HTML code) is not optimal in my opinion. What we really need is a "group" object:

{ "groupKey": <some key>, "groupContent": <some content> }

Groups should be referenced by keys and not by content. At the moment we compare long strings to find events of the same group. Do you know what I mean?

@josdejong
Copy link
Contributor

@ova2 please see #5 (and #87, #90, #105, #107, etc).

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

No branches or pull requests

3 participants