将jquery.dynatree-1.2.1.js升级到jquery.dynatree-1.2.4.js后出错

时间:2013-10-08 20:52:25

标签: jquery upgrade dynatree jquery-dynatree

将jquery版本1.9.1升级到版本1.10.2并将dynatree版本1.2.1升级到版本1.2.4后,我收到一个TypeError警告,当我点击我网站上的一个dynatree节点时,它说 - 消息:“对象[对象对象]没有方法'模糊'”

这打破了我与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;
        }
    }

0 个答案:

没有答案