ng网格在ie8中未显示网格



我正试图在一个客户端项目中使用ng网格显示一些数据,一切都很好,除了在IE8中(IE11的模拟模式和win7上的VM都通过browserstack),这里没有渲染网格(只渲染了用于保存列和行的容器div),我在控制台中得到的异常是:

"无法获取未定义或null引用的属性'width'">

"无法获取未定义或null引用的属性"scrollTop">

在基于.net的项目中使用nggrid(2.0.7版)和angular(1.2.3版)。(项目中使用的jQuery版本为1.11。)

由于IE中的控制台并没有给我更多关于痕迹的信息,我想我会问stackoverflow的优秀员工,是否有人面临类似的问题,或者有人知道该去哪里找。

祝你平安,提前感谢你抽出时间!

前端代码(已添加)这是前端上的部分代码

<div data-ng-controller="benefitsController" >
<div id="topOrderBox-list" class="topOrderBox">
<div class="left">
<div class="boxHeader">
Sök tjänst
</div>
<ul>
<li>
<label class="">
<b>Frisökning</b></label>
<span class="help" title="Fritextsökning: Här kan du anger olika saker ">[?]</span> </li>
<li>
<input class="freeSearch search" type="text" placeholder="Skriv ett sökord" ng-model="model.filterText" />
</li>
<li>
<label>
<b>Leverantörer</b></label>
<span class="help" title="Leverantörer: Här kan du söka efter en viss leverantör">[?]</span> </li>
<li>
<select class="partnersOption" ng-model="model.Partner" ng-options="partner.PartnerName for partner in model.Partners | orderBy:'PartnerName'">
<option value="">Välj en leverantör</option>
</select>
</li>
<li>
<label>
<b>Välj en typ av förmån</b></label>
<span class="help" title="Typ av förmån: Här kan du söka på olika typer av förmåner. ">[?]</span> </li>
<li>
<select class="subCategoryOption" data-ng-model="model.SubCategory" data-ng-options="subCategory.SubCategoryName for subCategory in model.SubCategories | orderBy:'SubCategoryName'">
<option value="">Välj en typ av förmån</option>
</select>
</li>
</ul>
</div>
<div class="right">
<div data-ng-grid="gridOptions" class="gridStyle"></div>
</div>

<div data-ng-if="!(selectedRow[0].IsOrderable)" class="benefitDetails overflow" data-ng-show="selectedRow.length > 0">
<ul>
<li>
<img id="partnerImageId" class="partnerImg" data-ng-src="@Url.Action("Show", "Image")/{{selectedRow[0].PartnerImageId}}" alt="Saknar tjänst bild"/>
<img id="benefitImageId" class="benefitImg" data-ng-src="@Url.Action("Show", "Image")/{{selectedRow[0].ImageId}}" alt="Saknar tjänst bild"/>
<h2>{{selectedRow[0].PartnerName}} {{selectedRow[0].BenefitName}} {{selectedRow[0].TimeSpanString}}, {{selectedRow[0].City}}</h2>
</li>
</ul>
</div>

</div>
<div class="benefitDetails overflow padding-top" ng-show="selectedRow.length > 0">

<div class="spanDiv">
<span ng-bind-html="selectedRow[0].CommonDescription"></span>
<br />
<br />
<span class="taxDescription" ng-bind-html="selectedRow[0].TaxDescription"></span>
</div>
</div>
<div class="bottomLinksBox">
<a data-ng-controller="sendOrderBenefitController" data-ng-click="goToTop()" class="up" href="#">Upp &uarr;</a>
<a data-ng-if="selectedRow[0].IsOrderable" class="buttonLink rightBox" id="goOnLink" ng-href="@Url.Action("OtherBenefitsOrdering")/{{selectedRow[0].EmployerBenefitId}}" >Gå vidare till beställning</a>
</div>
<div class="contractBox">
<p></p>
</div>
</div>

这是控制器中的一些代码

adderasApp.controller('benefitsController', ['$scope', 'benefitsService', function ($scope, benefitsService) {
$scope.model = benefitsService.Benefits.get({ isHealthCare: 'false' }, function () {
$scope.EmployerBenefits = $scope.model.EmployerBenefits;
});
$scope.selectedRow = [];
$scope.filterOptions = {
filterText: ''
};

$scope.gridOptions = {
data: 'EmployerBenefits',
columnDefs: [
{ field: 'PartnerName', displayName: 'Leverantör' },
{ field: 'City', displayName: 'Ort' },
{ field: 'BenefitName', displayName: 'Tjänst' },
{ field: 'SubCategoryName', displayName: 'Kategori' },
{ field: 'PriceString', displayName: 'Pris' },
{ field: 'TimeSpanString', displayName: 'Tid' },
],
multiSelect: false,
selectedItems: $scope.selectedRow,
filterOptions: $scope.filterOptions,
headerClass: 'otherBenefitSearchHeader'
//headerRowTemplate: '<div ng-style="{'z-index': col.zIndex()}" ng-class="{'col_select': col.showSortButtonDown(), 'col_select_up': col.showSortButtonUp() }" ng-repeat="col in visibleColumns()" class="ngHeaderCell col{{$index}}" ng-header-cell></div>'
};
$scope.$watch('[ model.Partner, model.SubCategory, model.filterText, model.CommonDescription]', function (newValue, oldValue) {

var searchText = [];
var isOrderable;
if (newValue[0] !== undefined && newValue[0] != null) {
searchText.push(newValue[0].PartnerName);
}
if (newValue[1] !== undefined && newValue[1] != null) {
searchText.push(newValue[1].SubCategoryName);
}
if (newValue[2] !== undefined && newValue[2] != null) {
searchText.push(newValue[2]);
}
if (newValue[3] !== undefined && newValue[3] != null) {
searchText.push(newValue[3].CommonDescription);
}
$scope.filterOptions.filterText = searchText.join(';');

}, true);
}]);

已尝试遵循http://docs.angularjs.org/guide/ie还有。

p.s.来自工厂/服务的数据从同一个域获取数据,并且数据似乎可以通过,其他不使用ng网格但使用restful服务的页面似乎工作得很好。

无论如何,再次感谢您为此付出的时间和精力!和平

我找到了解决方案!:)基本上,它的IE8对阅读js和非常挑剔,。我看完后解决了https://github.com/angular-ui/ng-grid/issues/543因此,在我的ng网格控制器代码中,我删除了gridOptions columnDefs对象中最后一个参数之后的。例如:

$scope.gridOptions = {
data: 'EmployerBenefits',
columnDefs: [
{ field: 'PartnerName', displayName: 'Leverantör' },
{ field: 'City', displayName: 'Ort' },
{ field: 'BenefitName', displayName: 'Tjänst' },
{ field: 'SubCategoryName', displayName: 'Kategori' },
{ field: 'PriceString', displayName: 'Pris' },
{ field: 'TimeSpanString', displayName: 'Tid' }
],
multiSelect: false,
selectedItems: $scope.selectedRow,
filterOptions: $scope.filterOptions,
headerClass: 'otherBenefitSearchHeader'
//headerRowTemplate: '<div ng-style="{'z-index': col.zIndex()}" ng-class="{'col_select': col.showSortButtonDown(), 'col_select_up': col.showSortButtonUp() }" ng-repeat="col in visibleColumns()" class="ngHeaderCell col{{$index}}" ng-header-cell></div>'
};

无论如何,和平和感谢投入的家伙!;)

Angular在10之前的IE中存在问题。按照本指南操作。也就是说,Angular和IE8有一些很难解决的问题。

对于我的应用程序,我不得不添加支持HTML5的垫片、Modernizr、完整的jQuery和HTML5控件的垫片。只是为了支持IE9和回来。它充其量是有斑点的。

最新更新