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

How to specify the starting number in an ordered list?

1 Answer 41 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Gus
Top achievements
Rank 2
Gus asked on 18 Feb 2010, 09:04 PM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 19 Feb 2010, 05:48 PM
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.
Tags
Editor
Asked by
Gus
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Share this question
or