Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
680
Find toolbar item in JavaScript
posted

How can I find a custom dropdown object in javascript? I have looked everywhere and am missing something very simple.

For example, in this code, I can see that I have the ID of the control but I cannot figure out how to get the actual object so I can set the text value. :

 

function WebEditor_BeforeAction(oEditor, actID, oEvent, p4, p5, p6, p7, p8, act) {      

        if (act == 'texthtml') {   
         //var btn = oEditor.Toolbar.;            
           alert("Drodpown: " +dd.Key + ", " + oEvent.Key + ", " + p4.Key + ", " + p5 + ", " + p6 + ", " + p7 + ", " + p8 + ", " + act);            
           if (edit)                
              edit._showHtml(!edit._html);
             iged_closePop();        
        } 

 

I have tried loads of dfifferent approaches and always get a null value. Let's pretend that the dropdown control is called ddMyItem as an example

Parents
  • 29417
    Offline posted

    Hello wireplay

    Thank you for posting in our forum. 

    Are you creating your own ToolbarDropDown?In that case, depending on what action you take on it ,the passed arguments will be different.For example if you have the following custom drop down: 

    <ighedit:ToolbarDropDown runat="server" ClientIDMode="Predictable" Type="Custom"

                        DropDownHeight="200px" DropDownWidth="150px" Height="20px" Key="MyActionKey" Title="CUSTOM"

                        Width="100px">

                        <Items>

                            <ighedit:ToolbarDropDownItem runat="server"  Act="Greeting" ClientIDMode="Predictable" />

                        </Items>

                    </ighedit:ToolbarDropDown>

    If you open the drop down then the act will be “pop” and the p4 argument will contain your editor’s client id.If you select a value from the drop down the act will be “MyActionKey”. Then p4 will be the selected item. 

    Once you have the client id of the editor (from p4 on the correct act) then you could get the element by id:

      var editor = document.getElementById(p4);

     Let me know if you have any questions or concerns on the matter. 

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://es.infragistics.com/support

     

Reply Children