Project

General

Profile

server push - setCurrentIndex of WSelectionBox doesn't work

Added by Dieter Knueppel over 12 years ago

WT 3.2.3 / Ubuntu 12.04LTS

Based on external event i would like to change:

- the image link of a WImage: "img->setImageLink(value ? "a.png\" : "b.png");\"

  • the currentIndex of a WSelectionBox: "selection->setCurrentIndex(value);"

Image change works, index change of WselectionBox not!

More precise the change is done on the server but not pushed to the browser.

Both is done within the same post callback function context.

In addition i added function calls:

- "selection->refresh();"

  • "app->triggerUpdate();"

w/o any success.

Where's the mistake?

Help is pretty much appreciated.

Thanks, Dieter


Replies (6)

RE: server push - setCurrentIndex of WSelectionBox doesn't work - Added by Koen Deforche over 12 years ago

Hey,

It sounds indeed like a bug. A small test case would probably provoke us to fix this quickly...

Regards,

koen

RE: server push - setCurrentIndex of WSelectionBox doesn't work - Added by Dieter Knueppel over 12 years ago

Hi koen,

sounds promising!

Please let me know in case i can contribute somehow.

Thanks,

Dieter

RE: server push - setCurrentIndex of WSelectionBox doesn't work - Added by Koen Deforche over 12 years ago

Hey Dieter,

You could help us by providing a test case ! That shows how you are using the API (with subtle choices that may affect the appearance of the bug).

Koen

RE: server push - setCurrentIndex of WSelectionBox doesn't work using jquery mobile - Added by Dieter Knueppel over 12 years ago

Hi Koen,

I analyzed the problem more in detail and tried to reproduce it within a simple example.

BTW, sorry haven't got your test case hint immediately ;-)

Actually it turned out that the problem depends on jquery mobile usage.

Therefore i also corrected the topic title.

w/o jquery mobile being included everything works fine!

Unfortunately it's a mobile web application and i have to use jquery mobile.

I' using jquery 1.8.2 and jquery mobile 1.2.0.

I also tried newer jquery (1.9) and jquery mobile (1.3 latest) version, w/o success.

This is my wt-config file content:

<server>
<application-settings location="*">
<progressive-bootstrap>true</progressive-bootstrap>
</application-settings>
</server>


I slightly modified the BroadCast (attached) example by adding the mentioned selection box and an image.

Expected behaviour would be that every second the counter increases and that the selection and the image toggles.

Behaviour seems to be not deterministic. In the BroadCast example also the image doesn't toggle.

Don't know to what extend jquery mobile already is supported?

Best regards,

Dieter

BroadCast.C (3.97 KB) BroadCast.C slightly modified BroadCast example

RE: server push - setCurrentIndex of WSelectionBox doesn't work - Added by Koen Deforche over 12 years ago

Hey,

In the past we've done a project with JQuery Mobile (investigating how it would interact with Wt), but we didn't commit to supporting it. Our main conclusion was that it could be made to work but it's a fight against many parts of JQuery Mobile that do things behind the back of Wt.

The main problem with a toolkit like JQuery Mobile is that it has its JavaScript and CSS is tightly interwoven. It would be much nicer to see the CSS of JQuery Mobile in a form like that of Twitter Bootstrap, which we did now integrate with great success.

I could fix the test-case by calling the 'refresh' method on the form element after updating it. You will probably want to create specialized widgets that invoke the appropriate jquery mobile methods at the right times.

        selection_->setCurrentIndex(server.getCount() & 1);
        selection_->doJavaScript("$('#" + selection_->id() + "').slider('refresh');");

Regards,

koen

RE: server push - setCurrentIndex of WSelectionBox doesn't work - Added by Dieter Knueppel over 12 years ago

Hi Koen,

ok, got your point.

I tried to refresh the widget as you suggested and it works!

Thanks a lot for your help.

Sometimes i get a jquery mobile error "cannot call methods on " + name + \" prior to initialization; \" with this change for the widget.

But that's a different topic and isn't really related to WT.

Thanks again,

Dieter

    (1-6/6)