2

I am using default ui-grid and now i want to remove column separator line (the line in between 2 columns for separation) from my grid. As You can see in plunkr, name and gender is separated by a thin grayish line. i have checked various solutions but i could not remove that separator. Instead of separator i need a space between columns here is my code. How can i achieve that... Plunkr Source

$scope.gridOptions = {
enableSorting: true,
enableFiltering: true,
showTreeExpandNoChildren: false,
columnDefs: [
  { name: 'name', width: '30%' },
  { name: 'gender', width: '20%' },
  { name: 'age', width: '20%' },
  { name: 'company', width: '25%' },
  { name: 'state', width: '35%' },
  { name: 'balance', width: '25%', cellFilter: 'currency' }
],
onRegisterApi: function( gridApi ) {
  $scope.gridApi = gridApi;
  $scope.gridApi.treeBase.on.rowExpanded($scope, function(row) {
    if( row.entity.$$hashKey === $scope.gridOptions.data[50].$$hashKey && !$scope.nodeLoaded ) {
      $interval(function() {
        $scope.gridOptions.data.splice(51,0,
          {name: 'Dynamic 1', gender: 'female', age: 53, company: 'Griddable grids', balance: 38000, $$treeLevel: 1},
          {name: 'Dynamic 2', gender: 'male', age: 18, company: 'Griddable grids', balance: 29000, $$treeLevel: 1}
        );
        $scope.nodeLoaded = true;
      }, 2000, 1);
    }
  });
}

};

3
  • Cannot understand your needs, what column separator? Commented Jul 15, 2015 at 6:18
  • I mean the line in between 2 columns for separation. That's the column separator Commented Jul 15, 2015 at 6:20
  • You can see in plunkr, name and gender is separated by a thin grayish line Commented Jul 15, 2015 at 6:22

1 Answer 1

2

You can play with columnDefs and cellClass, please check this

JS Snip:

   columnDefs: [
      { name: 'name', width: '30%', cellClass: 'noborder' },
      { name: 'gender', width: '20%', cellClass: 'noborder' },
      { name: 'age', width: '20%', cellClass: 'noborder' },
      { name: 'company', width: '25%', cellClass: 'noborder' },
      { name: 'state', width: '35%', cellClass: 'noborder' },
      { name: 'balance', width: '25%', cellClass: 'noborder', cellFilter: 'currency' }
    ],

CSS:

.noborder {
  border: none;
}

You can do almost the same for the header row with headerClassor headerCellTemplate

Sign up to request clarification or add additional context in comments.

2 Comments

for Headers headerClass:'noborder' is not working... It still shows the border around headers
Try using headerCellTemplateand add the noborder class to the cell template

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.