Need documentation to the whole Javascript API

Last post 04-29-2011, 4:27 AM by Sergejack. 3 replies.
Sort Posts: Previous Next
  •  04-28-2011, 2:55 AM 67352

    Need documentation to the whole Javascript API

    Hello.
     
    I cannot found a complete enough documentation on the javascript API.
    For instance, I've not discovered yet how to retrieve the selected value of a RichDropDownList.
     
    There's also other pieces of information I'm looking for, I'd like to know every attributes that can be used with RichListItem.
    I had to try random keywords to figure out about the existance and usage of "selectable".
     
    Thank you.
  •  04-28-2011, 3:17 PM 67360 in reply to 67352

    Re: Need documentation to the whole Javascript API

    Dear Sergejack,
     
    Please try the following snippet:

    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <html>
        <head>
      <title>JavaScript API</title>
      <link rel="stylesheet" href="../example.css" type="text/css" />
       <script language="JavaScript" type="text/javascript" >
           function getSelectedFormatBlock()
                     {
                         var formatblock = document.getElementById("CE_Editor1_IDformatblock");
                         var table = formatblock.getElementsByTagName("table")[0];
                         var spanArr = table.getElementsByTagName("span");
                         var textnode = spanArr[0].firstChild;
                         alert(textnode.nodeValue);                  
         }    
      </script>
      <script runat="server">
      override protected void OnInit(EventArgs e)
      {
       base.OnInit(e);
       Editor1.Text = @"<table cellspacing=""4"" cellpadding=""4"" border=""0""> <tbody> <tr> <td> <p> <img src=""http://cutesoft.net/Uploads/j0262681.jpg"" width=""80"" alt=""""/></p></td> <td> <p>When your algorithmic and programming skills have reached a level which you cannot improve any further, refining your team strategy will give you that extra edge you need to reach the top. We practiced programming contests with different team members and strategies for many years, and saw a lot of other teams do so too.  </p></td></tr> <tr> <td> <p>  <img src=""http://cutesoft.net/Uploads/PH02366J.jpg"" width=""80"" alt="""" /></p></td> <td> <p>From this we developed a theory about how an optimal team should behave during a contest. However, a refined strategy is not a must: The World Champions of 1995, Freiburg University, were a rookie team, and the winners of the 1994 Northwestern European Contest, Warsaw University, met only two weeks before that contest.  </p></td></tr></tbody></table> <br /> <br />";
       Editor1.SetScriptProperty("ServerTime",DateTime.Now.ToString("HH:mm:ss"));
      }
      </script>

        </head>
    <body>
        <form id="Form1" runat="server">     
                                    <CE:Editor id="Editor1" Width="860"  ThemeType="Office2007"
                                         Height="350"  runat="server">
                                    </CE:Editor><br />
                                 
                                    <p style="width: 580px">
                                        <input type="button" value="Get Selected Dropdown Item" onclick="getSelectedFormatBlock()" id="Button1">
                                       </p>
                                    <br />
        </form>
    </body>
    </html>

    <script language="JavaScript" type="text/javascript" >
      var editor1=document.getElementById("<%=Editor1.ClientID%>");
      if(editor1.IsReady)CuteEditor_OnInitialized(editor);
    </script>
     
    Thank you for asking
     
  •  04-29-2011, 2:12 AM 67369 in reply to 67360

    Re: Need documentation to the whole Javascript API

    The value isn't the textnode's data.
    It'smore likely to be the "val" attribute of the span itself.
     
    Anyway, I'm pretty used to deal with complex javascript and DOM exploration but unless there is no built in way to do what I want to do, I'd like to avoid using a direct approach and write all off again if someday the DOM curesoft construct changes.
     
    So, is there any built in (a interface) to do it or do I have to reverse engeneer your (x)hmlt markut and javascript ?
  •  04-29-2011, 4:27 AM 67372 in reply to 67369

    Re: Need documentation to the whole Javascript API

    So much time I wasted.
     
    After reverse engineering the curesoft minified (thx) javascript I finally found out how to do it.
    Once you get the RichDropDownList  DOM element, you can call GetValue() on it.
     
    Now THAT's the kind information you should give in a proper documentation (yes wasting 3 days looking for such information make me feel like using upper case).
View as RSS news feed in XML