Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8594

Re: Getwidth() doesn't retrieve width when control is set to auto?

$
0
0

Part of the problem is that any command you issue in BIAL or any component property update (including static width changes for instance), make a round-trip to the server in order to maintain application state/integrity/etc.  A responsive width property is prone to change due to resizing of the window so to constantly be hammering the server with responsive resize events wouldn't be ideal so I can understand the reason to just call it "-1" and not hammer the server-side.

 

That being said, if you are willing to use SDK, you could write a utility component to measure the DOM width of a component by DOM ID and wrap it in a ZTL method to expose in BIAL however this may be overkill if there's possibly a simpler way.  You could use jQuery to do something like:

 

var computedWidth = $("#the_DOM_ID_of_the_target_component").width();

 

You'd need to wrap this code in a getComputedWidth method for instance and bridge the calls between the ZTL/BIAL and the client-side width/height computations.

 

This would address the constant width updates that all components would have to do otherwise, and allow you to implement a BIAL-event based polling of a given component.  You'd need an SDK developer or experience to do this though.  Also another watch-out is that these generated DOM IDs are subject to the formation strategy used by Design Studio which is to say there is no guarantee that any derived ID formation may not change in 1.4 or beyond.

 

Also it's been advised that DOM manipulation isn't encouraged, however I'm a bit more open to say that if you are merely inspecting an HTML DOM element, there's little risk.


Viewing all articles
Browse latest Browse all 8594

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>