Text rendered not updated when using client-side set_text();

6 posts, 0 answers
  1. Aaron Mell
    Aaron Mell avatar
    12 posts
    Member since:
    Feb 2010

    Posted 14 Apr 2010 Link to this post

    I have the following javascript that is being called in the OnClientReordered event. I am trying to change the text of the items in the list when they are reordered. What I am seeing is the item does not update the first time the event fires. The second time the event fires the text gets rendered correctly. (The text is being changed properly, as I can put a watch on the values, and the text is correct. It is just not being rendered) Is there something I am doing incorrectly here? I could find no information from the documentation on the API.



    function SetcontentorderNumber() { 
            reg = new RegExp("\\[\\d*\\]") 
            var list = $find("<%= foo.ClientID %>"); 
            var length = list.get_items().get_count(); 
     
            list.trackChanges(); 
            for (var i = 0; i < length; i++) { 
                var text = list.getItem(i).get_text(); 
                if (reg.test(text)) { 
                    texttext = text.replace(reg, "[" + (i + 1) + "] "); 
                    list.getItem(i).set_text(text); 
                } 
                else { 
                    text = "[" + (i + 1) + "] " + text; 
                    list.getItem(i).set_text(text); 
                } 
            } 
            list.commitChanges(); 
        } 

  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 15 Apr 2010 Link to this post

    Hello Aaron Mell,

    The point is that OnClientReordered event fires when the reordering is just completed. However with changing to OnClientReordering the text will render correctly from the first time.

    <telerik:RadListBox ID="RadListBox1" runat="server" OnClientReordering="SetcontentorderNumber" AllowReorder="true">
                <ButtonSettings ReorderButtons="Common"></ButtonSettings>
                <Items>
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem1" />
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem2" />
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem3" />
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem4" />
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem5" />
                    <telerik:RadListBoxItem runat="server" Text="RadListBoxItem6" />
                </Items>
            </telerik:RadListBox>

    You may find a sample project in the attached .zip file.

    Hope this helps.

    Best wishes,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aaron Mell
    Aaron Mell avatar
    12 posts
    Member since:
    Feb 2010

    Posted 15 Apr 2010 Link to this post

    I tried the code both ways, using both the reordering, and the reordered event. Result is the same.
  5. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 15 Apr 2010 Link to this post

    Hello Aaron Mell,

    Here's the result when using the OnClientReordered event:


    and the result with OnClientReordering:



    Let me know if I am missing something.

    Best wishes,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Aaron Mell
    Aaron Mell avatar
    12 posts
    Member since:
    Feb 2010

    Posted 15 Apr 2010 Link to this post

    Veronica,
    I have identified the issue. It seems as though this issue is related to the version of the controls we are using. I tried the controls in a sample project with the newest controls, and it is working as expected. We cannot upgrade the controls at this time, but I will make note of it.
  7. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 16 Apr 2010 Link to this post

    Hello Aaron Mell,

    Please accept my apologies. I missed to write that I am using the latest version (2010.1.309) for the test.

    I'm glad you discovered that the problem is in the versions.

    Feel free to ask whenever you have other questions.

    All the best,
    Veronica Milcheva
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017