admin管理员组文章数量:1389928
I created a ui-grid in a modal within angualr js. In the modal each tab has its own ui grid. For this Profile tab I have a grid and I want to align the column titles being modified and originals. I also want to align the content within the Originals column. I am new to this, so any help is appreciated.
Code for Profile.js:
var app = angular.module('serviceDesk.restroom-services.profile', []);
app.controller('ProfileCtrl', [ '$scope', '$http', function($scope, $http) {
$scope.gridOptions = {
showGridFooter: true,
enableHorizontalScrollbar: 0,
showColumnFooter: false,
enableFiltering: false,
enableColumnMenus: false,
enableGridMenu: false,
columnDefs: [
{ field: 'empty', width: '33%', displayName: ''},
{ field: 'modified', width: '33%', displayName: 'Modified'},
{ field: 'original', width: '33%', displayName: 'Originals'},
],
data: [{
"empty":"Number of Employees(Daily)",
"modified":"",
"original":"20",
},
{
"empty":"Customer Restroom Visits(Daily)",
"modified":"",
"original":"5",
},
{
"empty":"Days Open per Week",
"modified":"",
"original":"5",
},
{
"empty":"Number of Restrooms",
"modified":"",
"original":"2",
},
{
"empty":"Number of Stalls",
"modified":"",
"original":"2",
},
{
"empty":"Number of Urinals",
"modified":"",
"original":"2",
},
{
"empty":"Delivery Frequency",
"modified":"",
"original":"Weekly Deliveries",
},
{
"empty":"Billing Frequency",
"modified":"",
"original":"Monthly",
}
],
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
}
};
$http.get("app/views/restroom-services/action/profile/profile.json").success(function(data) {
$scope.gridOptions.data = data;
});
}
]);
Not sure if this is needed but here is the code for Profile.html:
<div ng-controller="ProfileCtrl">
<!--button for profile..
<div class="users-button-group">
<button type="button" class="btn btn-aramark-primary btn-xs" ng-click="">Revert Profile</button>
</div>
-->
<div class="modal-body">
<div id="grid1" ui-grid="gridOptions" class="grid"></div>
</div>
I created a ui-grid in a modal within angualr js. In the modal each tab has its own ui grid. For this Profile tab I have a grid and I want to align the column titles being modified and originals. I also want to align the content within the Originals column. I am new to this, so any help is appreciated.
Code for Profile.js:
var app = angular.module('serviceDesk.restroom-services.profile', []);
app.controller('ProfileCtrl', [ '$scope', '$http', function($scope, $http) {
$scope.gridOptions = {
showGridFooter: true,
enableHorizontalScrollbar: 0,
showColumnFooter: false,
enableFiltering: false,
enableColumnMenus: false,
enableGridMenu: false,
columnDefs: [
{ field: 'empty', width: '33%', displayName: ''},
{ field: 'modified', width: '33%', displayName: 'Modified'},
{ field: 'original', width: '33%', displayName: 'Originals'},
],
data: [{
"empty":"Number of Employees(Daily)",
"modified":"",
"original":"20",
},
{
"empty":"Customer Restroom Visits(Daily)",
"modified":"",
"original":"5",
},
{
"empty":"Days Open per Week",
"modified":"",
"original":"5",
},
{
"empty":"Number of Restrooms",
"modified":"",
"original":"2",
},
{
"empty":"Number of Stalls",
"modified":"",
"original":"2",
},
{
"empty":"Number of Urinals",
"modified":"",
"original":"2",
},
{
"empty":"Delivery Frequency",
"modified":"",
"original":"Weekly Deliveries",
},
{
"empty":"Billing Frequency",
"modified":"",
"original":"Monthly",
}
],
onRegisterApi: function(gridApi) {
$scope.gridApi = gridApi;
}
};
$http.get("app/views/restroom-services/action/profile/profile.json").success(function(data) {
$scope.gridOptions.data = data;
});
}
]);
Not sure if this is needed but here is the code for Profile.html:
<div ng-controller="ProfileCtrl">
<!--button for profile..
<div class="users-button-group">
<button type="button" class="btn btn-aramark-primary btn-xs" ng-click="">Revert Profile</button>
</div>
-->
<div class="modal-body">
<div id="grid1" ui-grid="gridOptions" class="grid"></div>
</div>
Share
Improve this question
asked Oct 30, 2015 at 19:41
AdrewAdrew
2271 gold badge9 silver badges26 bronze badges
5
- Can you make a plunkr with your code? This link will take you straight to the plunkr editor: plnkr.co/edit/?p=catalogue – Katana24 Commented Oct 30, 2015 at 19:44
- @Katana24 ok let me set it up – Adrew Commented Oct 30, 2015 at 19:49
- @Katana24 I am using Bootstrap...forgot to mention – Adrew Commented Oct 30, 2015 at 19:52
- @Katana24 having trouble having it run since I use bootstrap for this project... – Adrew Commented Oct 30, 2015 at 20:13
- @Andrew Can't you just add bootstrap as you would any other problem? – Katana24 Commented Oct 31, 2015 at 16:55
1 Answer
Reset to default 3I figured out the problem.
Here I have two divs within the html page:
<div id="gridTest" ui-grid="gridOptions" class="grid"></div>
<div id="grid1" ui-grid="gridOptions2" class="grid"></div>
Here I am set the text to align center so that the header text is centered:
#gridTest .ui-grid-header-cell .ui-grid-cell-contents{
text-align:center;
}
After all this the header row should be aligned to the center.
本文标签: javascriptAngularJS uiGrid text alignmentStack Overflow
版权声明:本文标题:javascript - AngularJS ui-Grid text alignment - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744635712a2616810.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论