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

Treeview in Combobox IE Problem

4 Answers 77 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Teoman
Top achievements
Rank 1
Teoman asked on 05 Feb 2012, 03:04 PM
Hi,
We have treeview with checkbox in combobox.We dont have any problem with chrome and firefox but combobox doesnt closed when we focused out of the control in IE.

<telerik:RadComboBox ID="cbxDepartments" runat="server" DataTextField="DEPNAME" DataValueField="DEPID"
                                ExpandAnimation-Type="None" CollapseAnimation-Type="None" OnClientDropDownClosing="OnClientDropDownClosing"
                                AllowCustomText="True" EmptyMessage="-- seçiniz --">
                                <ItemTemplate>
                                    <div id="div1">
                                        <telerik:RadTreeView ID="tvDepartments" runat="server" DataTextField="DEPNAME" DataValueField="DEPID"
                                            DataFieldParentID="SUBDEPID" DataFieldID="DEPID" Height="140px" CheckBoxes="true">
                                        </telerik:RadTreeView>
                                    </div>
                                </ItemTemplate>
                                <Items>
                                    <telerik:RadComboBoxItem Text="" />
                                </Items>
                                <ExpandAnimation Type="Linear"></ExpandAnimation>
                                <CollapseAnimation Type="None"></CollapseAnimation>
                            </telerik:RadComboBox>

 <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function OnClientDropDownClosing(sender, args) {
                //            if (args.get_node().get_level() == 0)
                //            {
                //                args.set_cancel(true);
                //            }
                //            else {
                var item = sender.get_items().getItem(0); // Get the first RadComboBoxItem
                var treeView = item.findControl('tvDepartments'); // Find your RadTreeView
                var checkedNodes = treeView.get_checkedNodes(); // Retrieve the checked items in the RadTreeView

                var newText = '';
                checkedNodes.forEach(function (node) {  // Loop through the checked nodes. Requires jQuery!
                    if (newText != '') { newText += ', '; }
                    newText += node.get_text();
                });
                var comboBox = $find("<%= cbxDepartments.ClientID %>");
                comboBox.set_text(newText); // Set the RadComboBox text
                if ($.browser.msie) { // IE sometimes takes two tries for it to respond to new text
                    comboBox.set_text(newText);
                    //                }
                }
            }
        </script>


4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 Feb 2012, 05:06 AM
Hello,

I have tried to reproduce the issue but no avail. Here is the sample code I have tried.
JS:
function OnClientDropDownClosing(sender, args)
{
    var item = sender.get_items().getItem(0);
    var treeView = item.findControl('RadTreeView1');
    var checkedNodes = treeView.get_checkedNodes();
    var newText = '';
    checkedNodes.forEach(function (node)
    
      if (newText != '')
         {
            newText += ', ';
         }
           newText += node.get_text();
   });
   var comboBox = $find("<%= RadComboBox1.ClientID %>");
  comboBox.set_text(newText);
 }

Thanks,
Princy.
0
Teoman
Top achievements
Rank 1
answered on 13 Feb 2012, 12:31 AM
anybody help me please.my project dead line cooming soon and no solution yet.
0
Teoman
Top achievements
Rank 1
answered on 20 Feb 2012, 12:44 PM
my problem still hasnt been solved.can you help me please?
0
Teoman
Top achievements
Rank 1
answered on 29 Feb 2012, 12:30 AM
i have still same problem ie gives this error.

Message: Object doesn't support this property or method
Line: 15
Char: 9
Code: 0

checkedNodes.forEach(function (node)
Tags
ComboBox
Asked by
Teoman
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Teoman
Top achievements
Rank 1
Share this question
or