Drag handles are null on client load

4 posts, 0 answers
  1. Efficio
    Efficio avatar
    29 posts
    Member since:
    Jun 2019

    Posted 24 Jun Link to this post

    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);
              }

  2. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 29 Jun Link to this post

    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.
  3. Efficio
    Efficio avatar
    29 posts
    Member since:
    Jun 2019

    Posted 29 Jun in reply to Rumen Link to this post

    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.
  4. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 29 Jun Link to this post

    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.
Back to Top