저는 Angularjs의 ng-grid 구성 요소에 대해 교육 중이며 오히려 실망한 문제가 있습니다. 기본적으로 흐름은 다음과 같습니다. 페이지가로드되고 버튼 만 표시됩니다. 버튼을 클릭하면 AJAX 요청이 json 데이터를 가져 와서 그리드에 바인딩합니다. 나는 모든 브라우저의 크기를 조정하면 데이터를 채우고 표시 할 때 ng-grid 스타일이 바뀝니다.
, 올바른 크기로 다시 스냅 :
이
내가 먼저 버튼을 클릭하면 내가 볼 것입니다내 컨트롤러는 다음과 같습니다 :
myAppModule.controller('PodcastController', function ($scope, $http) {
$scope.getData = function() {
$http.get('/Home/PodcastDataAsJson').success(function (data) {
$scope.podcasts = data;
});
$scope.gridVisibilty = 'gridStyle';
};
$scope.gridOptions = {
data: 'podcasts',
columnDefs: [
{ field: 'Id', displayName: 'Id' },
{ field: 'Name', displayName: 'Name' },
{ field: 'Artist', displayName: 'Artist' }
]
};
$scope.gridVisibilty = 'notDisplayed';
});
보기는 다음과 같습니다
<div ng-app="gridExampleApp">
<div ng-controller="PodcastController">
<button ng-click="getData()">Click to get Data</button>
<div id="datagrid" ng-grid="gridOptions" class="ng-class: gridVisibilty;"></div>
</div>
</div>
012
.notDisplayed
{
display: none;
}
.displayed
{
display: block;
border: 1px solid rgb(212,212,212);
width: 800px;
height: 300px;
}
.gridStyle
{
display: block;
border: 1px solid rgb(212,212,212);
width: 400px;
height: 300px
}
나는이 날인지 알고 싶습니다, 또는 내가 각도 NG 그리드 친구들에 접수해야 버그 여부 : 3,516,
내 CSS는 다음과 같습니다.
건배
당신이 락! ng-show는 그것을 완전히 소트했다. 도움을 주셔서 감사합니다. 멋진 한 주를 보내십시오! – onefootswill