0

将 jquery 1.9.1 版升级到 1.10.2 版和 dynatree 1.2.1 版升级到 1.2.4 版后,我收到 TypeError 警告,当单击我网站上的一个 dynatree 节点时,它显示 - 消息:“对象 [对象 Object] 没有方法 'blur'"

这破坏了我与 dynatree 相关的一些过滤器。

这是升级前的工作代码。

有什么建议么?

html代码:

@using TGN.Common.Models

@model List<NameValuePair>

@helper DisplayRegion(NameValuePair regionReference)
{            
<li id="regionFilter_@(regionReference.Identifier)" data="icon:   
null">@(regionReference.Value)@(this.DisplayCities(regionReference))</li>
}

@helper DisplayCities(NameValuePair regionReference)
{
if
  (regionReference.ChildNameValuePairs != null &&   
   regionReference.ChildNameValuePairs.Any())
{
  <ul id="regionFilter_CityList_@(regionReference.Identifier)" style="display:none;">
    @foreach(var city in regionReference.ChildNameValuePairs)
        {
            <li id="cityFilter_@(city.Identifier)">@(city.Value)</li>
        }
  </ul>
}
else
{
    <input type="hidden" id="omitLocationFilter" value="true"/>
}
}

@if (!(Model.Count == 1 && Model[0].ChildNameValuePairs.Count == 1))
{
  <div id="locationFilterTree" style="border: none;">
      <ul class="checkboxlist-filter">
          @foreach (var region in Model)
          {
              @(this.DisplayRegion(region))
          }
      </ul>
  </div>
}

Javascript:

cities =  @Html.Raw(Json.Encode(Model.ProductSearchCriteria.Cities));
        locationFilterTree = $("#locationFilterTree");
        isinitialized = false;
        if (locationFilterTree.length === 1) {
            locationFilterTree.dynatree({
                checkbox: true,
                selectMode: 3,
                onSelect: function () {
                    if (document.location.href.indexOf("product") !== -1) {
                        if (isinitialized) {
                            doProductSearch();
                        }
                    }
                }
            });
        }
        resetLocationFilterTree = resetLocationFilterTree(cities);
        isinitialized = true;
    }
    function getSelectedCityIds() {
        var tree = $("#locationFilterTree").dynatree("getTree");

        var $cityIds = new Array();
        var cityIdNodes = tree.getSelectedNodes();

        $.map(cityIdNodes, function(node) {
            var segments = node.data.key.split("_");

            if (segments[0] == "cityFilter") {
                $cityIds.push(segments[1]);
            }
        });

        var nodeList = [];
        tree.visit(function(node) {
            if (!node.bSelected) {
                nodeList.push(node);
            }
        });

        if (nodeList.length > 1) {
            return $cityIds;
        } else {
            return null;
        }
    }
4

0 回答 0