How to specify the starting number in an ordered list?

2 posts, 1 answers
  1. Gus
    Gus avatar
    12 posts
    Member since:
    Sep 2012

    Posted 18 Feb 2010 Link to this post

    I have searched and surprisingly couldn't find any match on this topic.  I want my ordered list to start from a specific number and couldn't find any bullet list wizard tool to do it like in Adobe Indesign.

    Thanks.
  2. Answer
    Rumen
    Admin
    Rumen avatar
    14351 posts

    Posted 19 Feb 2010 Link to this post

    Hello Gus,

    You can accomplish this functionality by creating a custom tool which you can use in the following means:

    1. Select an ordered list inside the content area
    2. Click on the custom tool that will pop up a prompt that will ask you to enter a number. By specifying the number and pressing OK, the custom tool will insert an ordered list that will begin with the specified number value.

      You can get the current selected element by using the editor's client side API, e.g.
      var sel = editor.getSelectedElement();


    <telerik:RadEditor ID="RadEditor1" runat="server">
        <Tools>
            <telerik:EditorToolGroup>
                <telerik:EditorTool Name="insertorderedlist" />
                <telerik:EditorTool Name="CustomTool" />
            </telerik:EditorToolGroup>
        </Tools>
    </telerik:RadEditor>
     <script type="text/javascript">
         Telerik.Web.UI.Editor.CommandList["CustomTool"] = function(commandName, editor, args)
        {  
            var o = editor.getSelectedElement();
            while (o.tagName != 'OL' && o.tagName != 'BODY')
            {  
                o = o.parentElement;  
            }
     
            if (o.tagName == 'OL')
            {  
                o.setAttribute('start', prompt('',o.getAttribute('start')));  
            }  
        }  
    </script>

    This is just a simple example, which you should further enhance.

    Greetings,
    Rumen
    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