This is a migrated thread and some comments may be shown as answers.

Drag handles are null on client load

3 Answers 53 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Efficio
Top achievements
Rank 1
Efficio asked on 24 Jun 2020, 08:57 PM

We are attempting to update the drag handle text to match the current value.  The basic technique is outlined here: https://www.telerik.com/forums/display-the-current-values

The problem is that the text is not updated when the page is loaded.  We tried to access the drag handles (get_dragHandles()[0]) in the client load event, but the drag handles are null at that point.  Looking at the state of the control at this point shows some interesting values such as "initialized internal" being false and not value being set the for the "drag handle element".  If I retrieve the drag handles in another event such as value changed they exist and these values are set as expected.

_dragHandleElement: null
_initializedInternal: false

 

We simplified our example down to the following and the behavior is reproducible.  We are using version 2019.1.215.45 of the controls.

<telerik:RadSlider ID="sldTest" RenderMode="Lightweight" BackColor="Red" Value="50" ForeColor="Blue" MinimumValue="0" MaximumValue="100" Width="500" ShowDragHandle="True" OnClientLoad="sldTest_ClientLoad" OnClientValueChanged="sldTest_ClientValueChanged" runat="server" />
 

          function sldTest_ClientLoad(slider, args) {
              //alert(slider.get_dragHandles()[0]);
          }

          function sldTest_ClientValueChanged(slider, args) {
              alert(slider.get_dragHandles()[0].firstChild.innerHTML);
          }

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 29 Jun 2020, 01:19 PM

Hi Efficio,

I tested the provided code with the latest version 2020.2.617 and verified that it works as expected, e.g.

For your convenience, I have attached a video demonstration and my test page.

What you can try is to put a small setTimeout in the sldTest_ClientLoad function to make sure the HTML is being rendered and the slider client object created.

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Efficio
Top achievements
Rank 1
answered on 29 Jun 2020, 01:50 PM
OK, so sounds like this is a bug in an older version where the internals aren't fully loaded when load is called so I won't put any more time into it.  I set a delay of 2 seconds as a test and that seems to work, but I worry about the reliability.  We will hopefully upgrade soon, but in the meantime I will move forward with the delay workaround.
0
Rumen
Telerik team
answered on 29 Jun 2020, 02:53 PM

You can also experiment by reducing the timeout to 100 or even 0 and see how it behaves.

 

Regards,
Rumen
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Slider
Asked by
Efficio
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Efficio
Top achievements
Rank 1
Share this question
or