khan4019/tree-grid-directive

col_defs not working as expected

Opened this issue · 1 comments

My model has a field called "name". By default this shows up with a table header of "name". I'd like it to appear in the header as "Name" so I added the following definition of col_defs:

    $scope.col_defs = [
	{ field: "name",
	  displayName: "Name"},
    ];

But instead of changing the "name" header to "Name", it simply added an extra column called "Name" with the same data. Am I doing something wrong? Thanks!

Hi @thinkingbraindog,

sorry for the late response! You should note, that the first column is the "expand property" and is internally called "Name" (with big N). So if you want to change it's heading, you have to provide the expand-on property for the grid.

Example (not full code):
In the html page:
<tree-grid expand-on="vm.treeExpandProperty" ...

In the controller:

vm.treeExpandProperty = {
        field: "Name",
        displayName: " "
    };