@@ -322,7 +322,8 @@ javaxt.dhtml.Slider = function(parent, config) {
322322 //**************************************************************************
323323 //** setValue
324324 //**************************************************************************
325- /** Used to set the position of the slider.
325+ /** Used to set the position of the slider. Note that the update will be
326+ * deferred until the slider is rendered.
326327 * @param x A number or a string representing a percentage value (e.g. '50%').
327328 * If a number is provided and the "units" config is set to "percent", then
328329 * the number will be interpreted as a percent value from 0-100. Otherwise,
@@ -337,30 +338,31 @@ javaxt.dhtml.Slider = function(parent, config) {
337338 }
338339
339340
341+ onRender ( slider , function ( ) {
340342
341- var setValue = function ( x ) {
342- handle . style . left = ( x - ( handleWidth / 2 ) ) + 'px' ;
343- updateSlider ( x , silent ) ;
344- } ;
345-
346- if ( javaxt . dhtml . utils . isString ( x ) ) {
347- if ( x . lastIndexOf ( "%" ) === x . length - 1 ) {
348- x = parseFloat ( x . substring ( 0 , x . length - 1 ) ) ;
349- if ( isNaN ( x ) || x < 0 || x > 100 ) return ;
350- x = me . getWidth ( ) * ( x / 100 ) ;
351- setValue ( x ) ;
343+ var setValue = function ( x ) {
344+ handle . style . left = ( x - ( handleWidth / 2 ) ) + 'px' ;
345+ updateSlider ( x , silent ) ;
346+ } ;
347+
348+ if ( javaxt . dhtml . utils . isString ( x ) ) {
349+ if ( x . lastIndexOf ( "%" ) === x . length - 1 ) {
350+ x = parseFloat ( x . substring ( 0 , x . length - 1 ) ) ;
351+ if ( isNaN ( x ) || x < 0 || x > 100 ) return ;
352+ x = me . getWidth ( ) * ( x / 100 ) ;
353+ setValue ( x ) ;
354+ }
352355 }
353- }
354- else {
355- x = parseFloat ( x + "" ) ;
356- if ( x < 0 ) return ;
357- if ( config . units === "percent" ) {
358- if ( x > 100 ) return ;
359- x = me . getWidth ( ) * ( x / 100 ) ;
356+ else {
357+ x = parseFloat ( x + "" ) ;
358+ if ( x < 0 ) return ;
359+ if ( config . units === "percent" ) {
360+ if ( x > 100 ) return ;
361+ x = me . getWidth ( ) * ( x / 100 ) ;
362+ }
363+ setValue ( x ) ;
360364 }
361- setValue ( x ) ;
362- }
363-
365+ } ) ;
364366 } ;
365367
366368
0 commit comments