Project

General

Profile

Specific use of statelessness for client-side behaviour

Added by Maro RAB over 9 years ago

OK here's my problem :

I need to change the layout of widget A's children every time its WVBoxLayout changes size. I managed to do that using the layoutSizeAware option, but the constant calling for server-side method is, well, not optimal. I read about the stateless slots and I would like to know how it could be used to solve this problem if possible. And before you ask I have never done web developement before so I do not know javascript...I am more of a desktop/mobile dev.

Thank you for any contributions.


Replies (1)

RE: Specific use of statelessness for client-side behaviour - Added by Koen Deforche over 9 years ago

Hey,

No, a 'stateless slot' cannot depend on the size change (as that is state). What you can do is install your own JavaScript routine which reacts to layout size changes, and then rearrange your layout client-side.

  setJavaScriptMember(WT_RESIZE_JS, "function(object, width, height) { console.log(object, width, height); /* ... */ }");

If possible, you may still be able to avoid all this if you can make your layout react to the container width in an intelligent way using CSS, in a 'responsive' way ?

Koen

    (1-1/1)